T
TanStack3y ago
genetic-orange

Accessing previously paginated data within react query

Hey guys, i'm using React query to power a paginated table, the rows of the table are selectable. The table lib i'm using keeps an array in state of the selectedRowKeys. The issue i'm having is the react-query data at any one time is just that viewable page, so when I map through the array of selectedRowKeys to build the array of the full table rows with all the data, only a subset is there and I get an incomplete array. What's the best way to handle this (what I can imagine is a common issue? ) I could onChange push them on when I have those rows loaded in the hook, but then i'm having to manage 2 bits of state, and i'd rather have one derive the other. Any suggestions appreciated.
1 Reply
xenogeneic-maroon
xenogeneic-maroon3y ago
The part I'm having trouble understanding is:
when I map through the array of selectedRowKeys to build the array of the full table rows with all the data, only a subset is there and I get an incomplete array.
Are you trying to display selected rows that are not on the current page? If you can provide code and/or screenshot of the ui that'll help!

Did you find this page helpful?