-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(react-table): Add toggleSomeRows selection state #35291
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
base: master
Are you sure you want to change the base?
feat(react-table): Add toggleSomeRows selection state #35291
Conversation
…le-some-rows-selection-state
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR. I have a few comments:
- We likely don't need to modify the
useSelectionhook, as the component hook doesn't appear to use the new method. - I'm not sure this change is necessary, since it can be worked around with
toggleAllRowsortoggleRow, but I'll let the core maintainers @microsoft/teams-prg make the final decision.
| }); | ||
|
|
||
| const toggleSomeRows: TableSelectionState['toggleSomeRows'] = useEventCallback((e, rowIds: Set<TableRowId>) => { | ||
| selectionMethods.toggleAllItems( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If toggleAllItems could be used here, why do we need to add the used toggleSomeItems method to the useSelection hook?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was overlooked, updated to use toggleSomeItems.
…le-some-rows-selection-state
@microsoft-github-policy-service agree |
Previous Behavior
There was no simple way to toggle a subset of rows, only a single row (
toggleRow) or all rows (toggleAllRows).New Behavior
This PR adds
toggleSomeRows, allowing specific rows to be toggled for more flexible selection.