Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

277
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda