gregnb / mui-datatables

Datatables for React using Material-UI
MIT License
2.71k stars 931 forks source link

renderExpandableRow callback re-renders every expanded row #662

Open Diazole opened 5 years ago

Diazole commented 5 years ago

The renderExpandableRow callback re-renders every expanded row instead of the row that was just expanded.

I would like to fetch data and populate the row that was just expanded, however the current functionality means I will have to fetch data for every row that is already expanded.

Is this expected functionality?

Tech Version
MUI-datatables 2.3.0
React 16.8.6
gabrielliwerant commented 5 years ago

It looks like this is the way this works for now, but not sure what you mean by fetching data. I expect the performance hit here to be relatively small compared to other performance issues. If you are fetching data on row expand, you can add logic to store those values and then check if they exist in the callback to avoid duplicate requests.

mingfang commented 5 years ago

This is a huge problem for me. I have 500 rows with 12 columns each and pagination turned off. Expanding a row takes more than 5 seconds.

gabrielliwerant commented 5 years ago

@mingfang That sounds like a long time, even with a double render. Care to recreate your circumstances in a codesandbox so that it can be looked into more thoroughly?