Skip to content

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

Closed

Description

@simcha90

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

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

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

Activity

  1. vishwas0459 commented on Mar 7, 2024

    @vishwas0459

    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 commented on Jul 31, 2025

    @mylestlee

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions