T
TanStack•2y ago
metropolitan-bronze

Is there a way to apply offset to pagination ?

Hey ! 🙂 I am currently working on an app where the back-end have pagination starting at pageIndex=1 but tanstack-table starts with pageIndex=0. It creates few issues when trying to access last page. I am wondering if there is a way to deal with that ? For now my current solution is to completely remove the pagination state from tanstack table, and have it controlled outside of the component. Is it considered bad practice ?
1 Reply
ambitious-aqua
ambitious-aqua•2y ago
Not at all considered bad practice to manage the pagination outside of the Table hook. Just enable manualPagination. Conversely, you could just pass your paginationIndex as n-1. And your actual pagination-navigation could undo that with n+1. I'm assuming you mean server-side pagination here, since otherwise this could entirely be managed with Table.

Did you find this page helpful?