TanStackT
TanStack4y ago
5 replies
progressive-amaranth

Controlled Pagination and Selection in react table v8

I'm trying to combine these two examples:
- https://tanstack.com/table/v8/docs/examples/react/pagination-controlled
- https://tanstack.com/table/v8/docs/examples/react/row-selection

I've done pretty much a copy-paste job to implement the combined feature. I'm seeing that the state stored in rowSelection state from the row-selection example is only keeping track of the current page's selections. When I go from page 1 to page 2, the selections on page 1 are still there.

It's not clear from the docs why this is the case. Does anyone have a hint about how to get react-table to keep track of selections on a per-page basis even when the data is 'controlled'?
An example showing how to implement Pagination Controlled in React Table
React Table Pagination Controlled Example | TanStack Table Docs
Was this page helpful?