react-data-table-component icon indicating copy to clipboard operation
react-data-table-component copied to clipboard

It's not possible to control the selected rows + filter the rows at the same time

Open GuYounes opened this issue 3 years ago • 2 comments

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:

  1. Go to codesandbox
  2. Select all the users in the table
  3. Filter the table with the input in the header. Look for "Richard" per exemple
  4. 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

GuYounes avatar Sep 08 '22 09:09 GuYounes

@jbetancur any news on this ? Can I contribute to this maybe ?

GuYounes avatar Sep 27 '22 08:09 GuYounes

@GuYounes Do you have any solution for this? I'm also having the same issue. If you have solution please post it. Thanks.

rockyWal avatar Oct 17 '22 05:10 rockyWal