react-data-table-component
react-data-table-component copied to clipboard
It's not possible to control the selected rows + filter the rows at the same time
Issue Check list
- [x] Agree to the Code of Conduct
- [x] Read the README
- [x] You are using React 16.8.0+
- [x] You installed
styled-components - [x] Include relevant code or preferably a code sandbox
Describe the bug
If i want to control the selected rows with the selectableRowSelected and onSelectedRowsChange properties and at the same time filter the data given to the table, it will result by a loss of the selected rows which are no longer displayed due to the filtering.
To Reproduce
Steps to reproduce the behavior:
- Go to codesandbox
- Select all the users in the table
- Filter the table with the input in the header. Look for "Richard" per exemple
- You can see now only 1 row is selected. If you remove the filter in the input to show all the rows, you will see as well that there is only the row displayed by the filter which is still selected
Expected behavior
Keep the rows selected even if we filter
Code Sandbox, Screenshots, or Relevant Code
https://codesandbox.io/s/react-data-table-component-typescript-forked-noudn4?file=/src/index.tsx
Versions (please complete the following information)
- React (RDT requires 16.8.0+) 16.8.4
- Styled Components 4.4.1
- OS: Ubuntu 22.04
- Browser Chrome 103.0.5060.134
@jbetancur any news on this ? Can I contribute to this maybe ?
@GuYounes Do you have any solution for this? I'm also having the same issue. If you have solution please post it. Thanks.