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

226
Views
React Material Table : onRowAdd not refreshing

I am using Material Table for displaying table data.
Using onRowAdd, I am able to add a new row but the page is not refershing. It reloads and get stuck then I have to reload it again.

newData =>
                            new Promise(resolve => {
                                setTimeout(() => {
                                    resolve();
                                    this.setState(prevState => {
                                        this.props.saveSetting(newData, this.state.resource, "generalmessage.successMessage");
                                        const data = [...prevState.data];
                                        
                                        return { ...prevState, data };
                                    });
                                }, 600);
                            })    

Save Setting is the function that I am calling in sagas.

I am not able to understand what I am doing wrong here. Please guide me in this.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I'm not sure if you're using useState in your component. Anyway, I did my onRowAdd this way and it's working:

            onRowAdd: (newRow) =>
          new Promise((resolve, reject) => {
            setTableData([...tableData, newRow]);
            setTimeout(() => resolve(), 500);
          })

Hope this helps

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!