table
table copied to clipboard
Row selection acting strange when using fully controlled table
Describe the bug
When I try to use table row selection with fully controlled state and i'm on the second page, then it selects the first page.
I think it's either the selection function is not accounting for the page index in getToggleAllPageRowsSelectedHandler
OR it is re-rendering the page index back to 0.
Your minimal, reproducible example
https://codesandbox.io/s/tanstack-table-fullycontrolled-w-selection-gmuhmm?file=/src/main.tsx:667-702
Steps to reproduce
- Go to second, third, or fourth page of table
- Click the header selection
- See that something did get selected.
- Go back to first page and see the first page gets selected.
Expected behavior
As a user I expect to see the page that im on get selected when using the header selection.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
mac OS, chrome, Version 112.0.5615.49 (Official Build) (arm64)
react-table version
8.8.5
TypeScript version
No response
Additional context
No response
Terms & Code of Conduct
- [X] I agree to follow this project's Code of Conduct
- [X] I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
@tannerlinsley bump?
I agree that it is a bug.
@talatkuyuk any updates on this? https://github.com/TanStack/table/issues/4848 looks like the solution
Yup, as @changyeamoon mentioned. Using getRowId in table config sets given property as value which by rows will be managed. Any unike value will do so, it's not a bug it's a feature in my humble opionion :)