Skip to content
Source
Sign inSign up
TanStack/table

Toggle select all rows doesn't respect `canSelect()` condition #5398

Closedsimcha90(GitHub profile, opens in a new tab) opened this issue 2 comments

TanStack Table version

8.13.2

Framework/Library version

17.0.2

Describe the bug and the steps to reproduce it

  1. When you click unselect all rows it unselect even disabled rows (that was set for enableRowSelection)

  2. Second issue that it shows that all rows selected checkbox as checked (but should show indeterminate state) even if disabled row is not selected:

image

But when disabled row selected and other rows - not selected, it shows correctly indeterminate checkbox

(Please use Footer Checkbox for demonstration)

https://codesandbox.io/p/devbox/loving-voice-7sqqp7?file=%2Fsrc%2Fmain.tsx%3A109%2C13

Screenshots or Videos (Optional)

No response

Do you intend to try to help solve this bug with your own PR?

None

Terms & Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
  1. I am also facing the same issue. @simcha90 - You may want to update the rowSelection state type to remove the eslint error showing on your codesandbox link. const [rowSelection, setRowSelection] = React.useState<RowSelectionState>({0: true})

  2. mylestlee(GitHub profile, opens in a new tab)commented

    The first issue was fixed here however it seems to have been reintroduced in one of the next commits. I'm also facing this issue.

    For some reason table.getFilteredRowModel().flatRows.filter(row => row.getCanSelect()).length was removed which fixed the first issue.

  3. KevinVandy closed this

Sign in to join this conversation.