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

onSelectedRowsChange called when search is submitted

Open StuartMorris0 opened this issue 2 years ago • 0 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

Describe the bug

We have a table that uses selectable rows. When a user searches, the value is used to filter down the data for the table and display the filtered results. This all works as expected. The issue relates to selected rows. We use a callback as described in docs for the selected rows.

What happens is the onSelectedRowsChange function is called when search is submitted/data changes and causes an empty selectedRows attribute.

We see the search as being a data filter, not an entire new set of data. Therefore if you select a row, then search for data where the initial selection is not within, you loose the initial selection. I'd expect the same selection to be held in state whilst a filter is taking place (search). Otherwise if the search term is removed, so is your original selection.

StuartMorris0 avatar Nov 01 '23 12:11 StuartMorris0