WordPress database error: [Can't create/write to file '/tmp/#sql-temptable-4db-15410f-1a.MAI' (Errcode: 28 "No space left on device")]
SELECT p.*, o.option_value, GROUP_CONCAT(DISTINCT CONCAT(m.meta_key, "::", m.meta_value) separator "::::") as seo_meta, t.slug, tr.language_code as language FROM wp_posts p JOIN wp_postmeta m ON p.ID = m.post_id JOIN wp_options o ON o.option_name = "siteurl" JOIN wp_term_relationships r ON r.object_id = p.ID JOIN wp_term_taxonomy x ON x.term_taxonomy_id = r.term_taxonomy_id JOIN wp_terms t ON t.term_id = x.term_id JOIN wp_icl_translations tr ON p.ID = tr.element_id WHERE post_type = "page" AND post_status = "publish" AND tr.language_code = 'en' AND t.slug IN ('jquery') AND x.taxonomy = "page_cat" AND tr.element_type = "post_page" AND meta_key IN ("_yoast_wpseo_title", "_yoast_wpseo_metadesc") GROUP BY p.ID

WordPress database error: [Can't create/write to file '/tmp/#sql-temptable-4db-15410f-1b.MAI' (Errcode: 28 "No space left on device")]
SHOW FULL COLUMNS FROM `wp_options`

How disabled button in react of MDBDataTable

WordPress database error: [Can't create/write to file '/tmp/#sql-temptable-4db-15410f-1c.MAI' (Errcode: 28 "No space left on device")]
SELECT p.* FROM wp_mdb_forum_posts AS p LEFT JOIN wp_mdb_forum_posts AS q ON( q.Id = p.ParentId AND p.Id = q.AcceptedAnswerId ) WHERE p.PostTypeId = 2 AND p.ParentId = 111571 GROUP BY p.Id ORDER BY CASE WHEN q.Id IS NOT NULL THEN 1 ELSE 0 END DESC, p.UpvoteCount DESC, p.CreationDate ASC


Topic: How disabled button in react of MDBDataTable

Mauricio Cartagena asked 5 years ago

Expected behavior

Hello, how can I disable the button when I click

I have the next example, i have the next file main

import React, { useEffect } from 'react';
import {  MDBDataTable } from 'mdbreact';
import { useFetchInstituions } from '../../hooks/useFetchInstitutions';
import { useDispatch } from 'react-redux';
import { institutionSetActiveClear } from '../../actions/institution';

export const InstitutionScreen = () => {

    const dispatch = useDispatch();
    // Rename the name
    const { data_institutions:institutions } =  useFetchInstituions();

    const data = {
      columns: [
          {
            label: 'Nombre',
            field: 'nombre',
            sort: 'asc',
            width: 200,
          },
          {
            label: 'Direccion',
            field: 'direccion',
            sort: 'asc',
            width: 200
          },
          {
            label: 'Nit',
            field: 'nit',
            sort: 'asc',
            width: 200
          },
          {
            label: 'Telefono',
            field: 'telefono',
            sort: 'asc',
            width: 200
          },
          {
            label: 'Celular',
            field: 'celular',
            sort: 'asc',
            width: 200
          },
          {
            label: 'Imei',
            field: 'imei',
            sort: 'asc',
            width: 200
          },
          {
            label: 'Nombre de Contacto',
            field: 'nombre_contacto',
            sort: 'asc',
            width: 200
          },
          {
            label: 'Modificar',
            field: 'modified',
            sort: 'asc',
            width: 200
          },
          {
            label: 'Eliminar',
            field: 'deleted',
            sort: 'asc',
            width: 200
          },
      ],
      rows: institutions
    };

    useEffect( () => {

      dispatch( institutionSetActiveClear() );

    },[ dispatch ]);

    return (
        <div className="col-lg-12 animated fadeIn">
            <section className="panel">
                <header className="panel-heading">
                    Institutos
                </header>
                {
                  (data.rows !== [])
                  ?
                  <div className="panel-body">
                    <MDBDataTable
                        noRecordsFoundLabel="Cargando..."
                        scrollX
                        autoWidth={true}
                        maxHeight="40vh"
                        striped
                        bordered
                        small
                        data={ data }
                    />
                  </div>
                  :
                  <div className="panel-body">
                    <div>Cargando...</div>
                  </div>
                }
            </section>
        </div>
    )
}

to rescue the data create the file useFetchInstitutions.js

import Swal from 'sweetalert2';
import { useEffect, useState } from 'react';
import { useDispatch } from 'react-redux';
import { useHistory } from 'react-router-dom';
import { institutionLoaded, institutionSetActive } from '../actions/institution';
import { fetchConToken } from '../helpers/fetch';


export  const  useFetchInstituions = () =>{

    const dispatch = useDispatch();
    const [ uiDisabled, setUiDisabled] = useState( false )
    const history  = useHistory();

    const [ institutions, setInstitutions ] = useState({
        data_institutions:[]
    });
    const handleSwitchChange = () => {
        console.log( uiDisabled );
        setUiDisabled( true )
    };

    console.log( uiDisabled );

    useEffect(()=>{

        const fetchInstitution = () =>{

            fetchConToken( 'institutos/inst', 'GET' )
            .then(res => res.json())
            .then(json => {

                let rows = [];

                json.instituciones.forEach(item =>rows.push({
                    id_institucion:item.id_institucion,
                    nombre: item.nombre,
                    direccion: item.direccion,
                    celular: item.celular,
                    telefono: item.telefono ,
                    imei: item.imei,
                    nit: item.nit,
                    nombre_contacto:item.nombre_contacto,
                    modified: <button className="btn btn-primary" id= { item.id_institucion }  onClick= { ( e ) => { 
                        // It's a little more understandable
                        return(
                            dispatch( institutionLoaded(  json.instituciones ) ),
                            dispatch( institutionSetActive( json.instituciones, e.target.id  ) ),
                            history.push('/institution/update')
                        )
                    }}>Modificar</button>,
                    deleted: <button className="btn btn-success"  disabled={ uiDisabled } id= { item.id_institucion } 
                        onClick = { ( e ) => {
                            return (
                                handleSwitchChange(),
                                institutionDelete( e.target.id )  
                            )
                        }}
                    >Eliminar</button>
                }));
                setInstitutions( { data_institutions:rows });
            })
            .catch(err => console.error(err));

        }
        const institutionDelete = ( id_institucion ) => { 

            fetchConToken( 'institutos/delete', { 
                id_institucion
            }, 'DELETE')
            .then(res => {
                if (res.ok) { 
                    Swal.fire(':)','Institución Eliminada', 'success');
                    fetchInstitution();
                }
            })
            .catch(err => (
                console.error(err)),
            );
        };
        fetchInstitution();

        return () => {
            setInstitutions({ data_institutions:[] });
            setUiDisabled( false );
        }  

    },[ history, dispatch, uiDisabled ]);

    return institutions; 

}

at the moment of pressing the delete button it deletes the institution but does not change me the event disabled disable={ true }

I should change the event disabled, but I understood that the whole table needs to be redrawn

is there any way to change the status in the delete process to avoid too many button clicks


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Open

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB React
  • MDB Version: 5.0.1
  • Device: Web
  • Browser: Chrome
  • OS: mac
  • Provided sample code: No
  • Provided link: No