-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
row selection not working for nested rows (getSubRows
)
#4878
Comments
Also see: #4720 @tannerlinsley could you please take a look at this 🥹🙏 I really want to use tabstack table for a project but this specific issue is preventing me from being able to use it. This naive UI example here (cascade checking) has the behavior we are expecting: https://www.naiveui.com/en-US/os-theme/components/tree#cascade.vue |
bump |
I use this workaround until the bug is fixed (React): useEffect(() => {
const { rows } = table.getRowModel();
rows.forEach((row) => {
const allSuRowsSelected = row.subRows.length > 0 && row.subRows.every(({ getIsSelected }) => getIsSelected());
if (allSuRowsSelected) {
row.toggleSelected(true);
}
});
}, [rowSelection, table]); |
Link to fix: |
bump, issue is actual Current workaround is to toggle manually useEffect(() => {
const { rows } = table.getRowModel();
rows.forEach((row) => {
if (row.subRows.length > 0) {
if (row.getIsAllSubRowsSelected() === true) {
row.toggleSelected(true);
} else if (row.getIsSomeSelected() === false) {
row.toggleSelected(false);
}
}
});
}, [rowSelection, table]); |
Any updates on this issue? |
Just noticed the same issue 👍 |
Yep, I've run into this issue too. |
same issue here |
This is a great fix since the issue is still occurring, thank you! I noticed that the table.getIsSomeRowsSelected() handler isn't counting grouped rows that are being selected, so to fix this I fixed up a function you can use to check if any are selected in the grouped or subrows, hope it helps someone like it did for me.
|
same issue |
Following this issue. |
same issue |
Describe the bug
row-selection in the group rows are not correctly reacting to their sub-rows row-selection state
Your minimal, reproducible example
https://codesandbox.io/s/row-selection-sub-rows-kfgh2j
Steps to reproduce
Probably the same issue:
Expected behavior
As a user, I expected the parent row to react to the row-selection status of its children, regardless on how they are selected/unselected:
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
Happens in codesandbox
react-table version
v8.9.1
TypeScript version
N/A - whatever codesandbox uses
Additional context
No response
Terms & Code of Conduct
The text was updated successfully, but these errors were encountered: