Skip to content

fix(selection): update logic to fix selection of disabled rows - #5401

Closed
simcha90 wants to merge 3 commits into
TanStack:mainfrom
simcha90:fix-disabled-selection
Closed

fix(selection): update logic to fix selection of disabled rows#5401
simcha90 wants to merge 3 commits into
TanStack:mainfrom
simcha90:fix-disabled-selection

Conversation

@simcha90

@simcha90 simcha90 commented Mar 10, 2024

Copy link
Copy Markdown

Fix issue:

#5398

We updated logic for selection of disabled rows (at least for pagination).

Here next possible flows:

  1. One row disabled and selected then click on Footer checkbox:
  • if all other rows selected - Footer checkbox: SELECTED
  • if all other rows unselected - Footer checkbox: INDETERMINATE
  1. One row disabled and unselected then click on Footer checkbox:
  • if all other rows selected - Footer checkbox: INDETERMINATE
  • if all other rows unselected - Footer checkbox: UNSELECTED
  1. One row disabled and selected and One row disabled and unselected then click on Footer checkbox:
  • if all other rows selected - Footer checkbox: INDETERMINATE
  • if all other rows unselected - Footer checkbox: INDETERMINATE

Status of all enabled checkboxes always will be toggled, but sign inside Footer checkbox will show real state of all checkboxes

P.S. Also getToggleAllRowsSelectedHandler respect disabled checkboxes

Comment on lines +447 to +458
const getIsSomeSelectedByCondition = () => {
return ignoreCanSelect
? paginationFlatRows.some(
d => d.getIsSelected() || d.getIsSomeSelected()
) &&
paginationFlatRows.some(
d => !d.getIsSelected() || !d.getIsSomeSelected()
)
: paginationFlatRows
.filter(row => row.getCanSelect())
.some(d => d.getIsSelected() || d.getIsSomeSelected())
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the readability is still lacking.
How about separating this part into an independent function or clearly splitting it with if-else statements?

@KevinVandy

Copy link
Copy Markdown
Member

closing in favor of #6495

@KevinVandy KevinVandy closed this Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants