Open alexanderluiscampino opened 1 year ago
Just to add a bit more from researching, it looks like the problem is somewhere in the method getFilteredRowModel which when a global filter is active in conjunction with filterFromLeafRows doesn't behave as expected.
This might be connected to https://github.com/TanStack/table/issues/4768. Please check the additional context of this issue, as it points out https://github.com/TanStack/table/blob/main/packages/table-core/src/utils/filterRowsUtils.ts#L63 as the possible origin of this bug.
This could be relevant for this issue, too.
@alexanderluiscampino Did you find where the problem is and/or some sort of workaround?
It's not ideal but for now I'm reapplying the filter where I need it like this: matchSorter(subRows, globalFilter)
@Zertz I haven't gotten to the bottom of it...
Describe the bug
Kinda weird why this is happening, and maybe I am missing something in the documentation. But I am trying to set up a table with sub-rows, filtering, sorting, and row selection. I need the leaf rows to be filtered hence I used the option filterfromleafrows.
Something happens when this option is enabled that the checkbox to select all rows becomes unavailable. Upon further digging I found that the issue is with the methods: getIsAllRowsSelected and getIsSomeRowsSelected that return false always no matter what the row selection is. The checkbox itself behaves as expected, but because the inputs for indeterminate and checked, as given in the example here, are always false, the user cannot use the header checkbox to select all rows.
I need this functionality since my users will basically apply some sort of filtering and then they wish to select all.
Below I have a minimal reproduction example, where I add a checkbox input to switch the
filterfromleafrows
option. Do notice how the header checkbox, the select all one, if selected prior, will become unchecked as we flip thefilterfromleafrows
control.If not filter is applied to the table, it behaves as it should. Hence, this only happens post-filtering the table.
I also added a filter input to the example.
Your minimal, reproducible example
Couldn't get your checkbox to work on the codesandbox.
Steps to reproduce
Expected behavior
To be able to select all rows upon filtering the table.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
Linux on Chrome
react-table version
8.7.9
TypeScript version
4.5.4
Additional context
No response
Terms & Code of Conduct