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(table-core): Do not select subrows if enableSubRowSelection is set to false #5274

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

Conversation

jpedroh
Copy link
Contributor

@jpedroh jpedroh commented Jan 14, 2024

Fixes #5116.

There are two cases here that were not being covered by the current code:

  • If enableSubRowSelection is a boolean and is set to true, then only the first level of rows should be selected. We can easily achieve this by iterating over rows instead of flatRows.
  • The more complicated case is when enableSubRowSelection is a function. In this scenario we must run the check recursively for all subrows. The easiest way I've found to solve this was to just iterate over rows using the mutateRowIsSelected helper function.

In order to not losing the performance improvement that was already implemented, I've kept the old flow and just in case enableRowSeleciton is a function, we will reach the slower path (which might not be very common anyway)

@jpedroh jpedroh marked this pull request as draft January 14, 2024 14:51
@jpedroh jpedroh marked this pull request as ready for review January 14, 2024 15:31
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.

getToggleAllRowsSelectedHandler doesn't take into account enableSubRowSelection property
1 participant