Add support for proper pagination with an unknown pageCount #5407
Unanswered
j-bossmann
asked this question in
Ideas
Replies: 1 comment
-
Same here. The endpoint is on the heavy side, so backend doesn't want to query for the number of rows, but does send a "hasNextRow"/"hasPrevRow" variables with the data. I'm going to try setting the pageCount to current-page, but this seems hacky to me. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to use a paginated table, but the API that I talk to for fetching my data doesn't return the total number of pages or rows. But the API returns whether the requested page is the last page or if there are more pages. If there are more pages, the table method
getCanNextPage
should return true. If the requested page is the last one,getCanNextPage
should return false. Thus the nextpage button in the pagination component can be disabled if there are no more pages.Right now, there seems to be no way of hooking into this method. The only way would be to set
pageCount
to the current page inuseReactTable
when the API returns that there are no more pages.I think it'd be a nice feature to just specify if there are more pages instead of the total page count because this is a lot cheaper to calculate with a database query. One way to achieve this is to extend the properties passed to
useReactTable
bygetCanNextPage
, which can be used to specify your own version ofgetCanNextPage
.Beta Was this translation helpful? Give feedback.
All reactions