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

`onSelectedRowsChange` does not fire if `clearSelectedRows` is toggled

Open ADTC opened this issue 1 year 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
  • [x] Include relevant code or preferably a code sandbox

Describe the bug

onSelectedRowsChange does not fire if clearSelectedRows is toggled. Selection is cleared visually, but the callback is not fired to update with new selection count (which is zero) or selected rows list (which is empty).

To Reproduce

Make a DataTable which has both. Select some rows. Use some button to toggle clearSelectedRows and observe the effect of onSelectedRowsChange (output it to console or update some div with it).

Expected behavior

Any time the selection changes for any reason, onSelectedRowsChange must always fire.

Note: I have keyField defined correctly.

(Pressed for time right now. I can add more details later.)

ADTC avatar Mar 12 '24 02:03 ADTC