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.03k stars 409 forks source link

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

Open ADTC opened 5 months ago

ADTC commented 5 months ago

Issue Check list

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.)