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

211
Views
Cómo ajustar las filas y columnas de la cuadrícula de datos de MUI en useRef (para corregir el bucle infinito en onSortModelChange)

Tengo el mismo problema que la pregunta de abajo. Un comentario decía usar useRef para envolver filas y columnas y usar su valor .current. ¿¿Cómo puedo hacer eso??

Material-UI Data Grid onSortModelChange que provoca un bucle infinito

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

0

No pude descifrar el useRef, y al ver que esta publicación tiene un mes, lo más probable es que ya la hayas resuelto. Pero para otros como yo que buscamos una solución en Google, así es como resolví el problema:

 const [sortModel, setSortModel] = useState<GridSortModel>([ { field: 'created', sort: 'desc', }, ]); const handleSortChange = (model: GridSortModel) => { /* if statement to prevent the infinite loop by confirming model is different than the current sortModel state */ if (JSON.stringify(model) !== JSON.stringify(sortModel)) { setSortModel(model); } }; <DataGrid rows={taskData} columns={myWorkColumns} sortModel={sortModel} onSortModelChange={(model) => handleSortChange(model)} />
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!