Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

278
Vistas
Update table data in switch in mui-datatables while my data is in boolean

I want to update my boolean data while displaying in Switch in each row (data fetched from firestore )

The data is being displayed correctly but while clicking on it to change it either true of false it's not working. Here is my code..

{
      name: "is_verified",
      label: "Verified",
      options: {
        customBodyRender: (value, tableMeta, updateValue) => {
          return (
         
                        <Switch
                          checked={value}
                          onChange={
                            async (e) => {
                              e.preventDefault();
                             //tableMeta.rowData[0] is my document id
                             const docsRef = doc(db, "vendors" , tableMeta.rowData[0])
                             await updateDoc(docsRef, {
                                value: e.target.checked,
                                 
                              })

                            }
                          }
                          name="active"
                          color="primary"
                        />
          )
      }
      }
     }
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Issue Solved

{
      name: "is_verified",
      label: "Verified",
      options: {
        customBodyRender: (value, tableMeta, updateValue) => {
          return ( 
              <Switch
              checked={value}
              onChange={
                async (e) => {
                  e.preventDefault();
                  updateValue(e.target.checked);
                 //tableMeta.rowData[0] is my document id
                 const docsRef = doc(db, "vendors" , tableMeta.rowData[0])
                 await updateDoc(docsRef, {
                  is_verified: !value,
                     
                  })

                }
              }
              name="active"
              color="primary"
            /> 
          )
      }
      }
     }

Online Doc

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda