Describe the bug
I've noticed differences in how selection of all rows is treated when using standard vs. server-side pagination.
As we see in the official example here: https://tanstack.com/table/v8/docs/examples/react/row-selection toggling "all rows selection" affects truly all rows in the table. The rows are present from the start, so we we don't need to define getRowId, everything is fine.
But when we use server-side pagination, we'd need to provide the getRowId since we can't rely on the raw row index since it resets for every page (I suppose that's the reason?). Otherwise we'll notice a side-effect like here #4555 or #3619.
However, with getRowId defined the table.getToggleAllRowsSelectedHandler() affects only rows on the current page (even though there is a special handler for that? This one table.getToggleAllPageRowsSelectedHandler?). Furthermore, the table.getIsAllRowsSelected() also returns true when just the entries on the current page are selected.
So I'm wandering, if this behaviour is intended, then why when using the "standard" pagination the table.getToggleAllRowsSelectedHandler() affects all pages (and with server-side pagination only the current page)? How can I achieve the same behaviour when using the server-side pagination?
I "created" a codesandbox by merging the two examples: https://tanstack.com/table/v8/docs/examples/react/row-selection and https://tanstack.com/table/v8/docs/examples/react/pagination-controlled
Your minimal, reproducible example
https://codesandbox.io/p/sandbox/tanstack-table-controlled-pagination-row-selection-fbkc6x?file=%2Fsrc%2Fmain.tsx&selection=%5B%7B%22endColumn%22%3A8%2C%22endLineNumber%22%3A151%2C%22startColumn%22%3A8%2C%22startLineNumber%22%3A151%7D%5D
Steps to reproduce
Using the linked Codesanbox:
"Bug" 1
- Check the "Select All" checkbox
- Go to another page -> no rows are selected
"Bug" 2
- Check the "Select All" checkbox
- De-select 1 entry, so the "Select All" checkbox becomes intermediate
- Go to another page -> no rows are selected, but "Select All" checkbox still intermediate
- Select any entry (on that new page you just switched to) - "Select All" checkbox becomes unchecked, as if no rows are selected at all, but all previously selected rows are actually still selected
Expected behavior
I'd expect that the kind of pagination doesn't affect how "toggle all rows selection" works.
How often does this bug happen?
None
Screenshots or Videos
No response
Platform
macOS, Chrome
react-table version
8.8.4
TypeScript version
5.6.4
Additional context
No response
Terms & Code of Conduct
Describe the bug
I've noticed differences in how selection of all rows is treated when using standard vs. server-side pagination.
As we see in the official example here: https://tanstack.com/table/v8/docs/examples/react/row-selection toggling "all rows selection" affects truly all rows in the table. The rows are present from the start, so we we don't need to define
getRowId, everything is fine.But when we use server-side pagination, we'd need to provide the
getRowIdsince we can't rely on the raw row index since it resets for every page (I suppose that's the reason?). Otherwise we'll notice a side-effect like here #4555 or #3619.However, with
getRowIddefined thetable.getToggleAllRowsSelectedHandler()affects only rows on the current page (even though there is a special handler for that? This onetable.getToggleAllPageRowsSelectedHandler?). Furthermore, thetable.getIsAllRowsSelected()also returns true when just the entries on the current page are selected.So I'm wandering, if this behaviour is intended, then why when using the "standard" pagination the
table.getToggleAllRowsSelectedHandler()affects all pages (and with server-side pagination only the current page)? How can I achieve the same behaviour when using the server-side pagination?I "created" a codesandbox by merging the two examples: https://tanstack.com/table/v8/docs/examples/react/row-selection and https://tanstack.com/table/v8/docs/examples/react/pagination-controlled
Your minimal, reproducible example
https://codesandbox.io/p/sandbox/tanstack-table-controlled-pagination-row-selection-fbkc6x?file=%2Fsrc%2Fmain.tsx&selection=%5B%7B%22endColumn%22%3A8%2C%22endLineNumber%22%3A151%2C%22startColumn%22%3A8%2C%22startLineNumber%22%3A151%7D%5D
Steps to reproduce
Using the linked Codesanbox:
"Bug" 1
"Bug" 2
Expected behavior
I'd expect that the kind of pagination doesn't affect how "toggle all rows selection" works.
How often does this bug happen?
None
Screenshots or Videos
No response
Platform
macOS, Chrome
react-table version
8.8.4
TypeScript version
5.6.4
Additional context
No response
Terms & Code of Conduct