Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

286
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!