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
getIsAllRowsExpanded #4216
Comments
I am adding a comment here because I think this issue is still not fixed. If look at the code here: https://github.com/TanStack/table/blob/main/packages/table-core/src/features/Expanding.ts#L131 I am having the issue on my project, and it seems to be related to this. Was it supposed to be already fixed? I am using latest version 8.5.11 |
In my opinion this is still broken. For the line @simplecommerce marked, what should be done here is, that you only want to check whether ONLY the rows that contain I believe, this is the correct code for the marked line above (@simplecommerce). WDYT? const areSomeExpandableRowsCollapsed = table
.getRowModel()
.flatRows.filter((row) => !!row.subRows?.length)
.some((row) =>!row.getIsExpanded())
if (areSomeExpandableRowsCollapsed) {
return false
} or const areSomeExpandableRowsCollapsed = table.getRowModel().flatRows.some((row) => {
const isRowExpandable = row.subRows?.length
return isRowExpandable && !row.getIsExpanded()
})
if (areSomeExpandableRowsCollapsed) {
return false
} Note: I've extracted some conditions to variables for easier readability. |
I forgot about this one, I think I did something similar on my end to bypass it and I used |
Thanks for confirming this. I've improved the readability of the above: return table.getRowModel().flatRows.some((row) => {
const isRowExpandable = !!row.subRows?.length
if (!isRowExpandable) {
return false
}
const isRowCollapsed = !row.getIsExpanded()
return isRowCollapsed
}) I also have a problem with function onToggleAllRowsExpanded() {
const isAllExpandableRowsExpanded = !areSomeExpandableRowsCollapsed
if (isAllExpandableRowsExpanded) {
table.resetExpanded()
return
}
table.toggleAllRowsExpanded()
} This is probably an unrelated bug, but worth mentioning. If it's confirmed I can create an issue for it. |
haven't had the issue, I use |
Describe the bug
This does not work, and it looks incorrect in the source code
I'm guessing there should be a
!
in front of thatrow.getIsExpanded()
?I've never contributed to an OS project, and unfortunately a bit short on time to figure it out at the moment
Your minimal, reproducible example
x
Steps to reproduce
x
Expected behavior
x
How often does this bug happen?
No response
Screenshots or Videos
x
Platform
x
react-table version
latest
TypeScript version
No response
Additional context
No response
Terms & Code of Conduct
The text was updated successfully, but these errors were encountered: