gregnb / gregnb/mui-datatables
How to prevent re-render after click on custom column buttons
- Dominant language
- JavaScript
- Stars
- 2.7k
- Forks
- 906
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
This is an awesome package that have been very helpful for me and a true time saver (so thanks ! ) but I have an issue with the table re-rendering on click on buttons.
I have a column with customBodyRender containing a button for downloading a file. On click on this button the state value "isLoading" is set to true in order to display a loading spinner.
The table data is not at all updated so there is no need to re-render the table and lose all filters or sorting.
Is there an option to prevent the re-rendering ? or any workaround ?
## Expected Behavior
The table should not re-render if the data is not changed.
## Current Behavior
The table re-render on click on a button that does not update the table data.
## Steps to Reproduce (for bugs)
1. create a custom column with button having onclick function that updates a state other than the table data.
2. select a filter or sort a column
3. click on the button
4. table is re-rendered having lost all filters, sorting (and probably pagination).
## Your Environment
| Tech | Version |
|--------------|---------|
| Material-UI | 4.0.0 |
| MUI-datatables | 2.7.0 |
| React | 16.8.6 |
| browser | Chrome, IE |
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.