Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

simcha90
Copy link

@simcha90 simcha90 commented Mar 10, 2024

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())
}

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?

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.

2 participants