jbetancur / react-data-table-component

A responsive table library with built-in sorting, pagination, selection, expandable rows, and customizable styling.
https://react-data-table-component.netlify.app
Apache License 2.0
2.04k stars 411 forks source link

persistSelectedOnPageChange with paginationServer as true its not retaining the selected checkbox when user navigates to next page and come back #1190

Open musharafshaikh16 opened 8 months ago

musharafshaikh16 commented 8 months ago

We are using the react-data-table-component library for table view.

But we are facing checkbox selection issue as we are making API call when user change the page using pagination. We are also passing onSelectedRowsChange props function, persistSelectedOnPageChange as true, paginationServer as true but still its not resolving our issue.

If we use selectableRowSelected props its checking for each row of table based on the condition and going to infinite loop because our API return 100 records for every page and in total we have almost more than 1k records. When we try to check the checkbox it basically hits onSelectedRowsChange method but, also it again checking selectableRowSelected defined method condition which is making infinite loop.

Could you please help us to resolve this issue or any workaround that can fix this issue.