Server side pagination with V8: getCanNextPage
issue.
#3822
Replies: 4 comments 1 reply
-
@tannerlinsley curious, is this implementation intentional? If not I can open up a PR. Function in question - https://github.com/TanStack/react-table/blob/bd8e89abb35be7c1a4daf51fa2c0b97f3b8c8737/packages/table-core/src/features/Pagination.ts#L189 |
Beta Was this translation helpful? Give feedback.
-
Happy to review a PR to make it better.
Tanner Linsley
…On Apr 12, 2022, 2:43 PM -0600, Colin ***@***.***>, wrote:
@tannerlinsley curious, is this implementation intentional? If not I can open up a PR.
Function in question - https://github.com/TanStack/react-table/blob/bd8e89abb35be7c1a4daf51fa2c0b97f3b8c8737/packages/table-core/src/features/Pagination.ts#L189
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Hi @colindjk, I am trying to implement manual pagination with react table v.8. The example in the docs is related with the client-side pagination. I suppose you have implemented a server-side pagination as far as I understand from your PR. Can you share the implementation in order to figure out and inspire how to use manual pagination in v.8? |
Beta Was this translation helpful? Give feedback.
-
Yeah sure!
Tanner Linsley
…On Apr 10, 2022, 6:48 PM -0600, Colin ***@***.***>, wrote:
Hello again, loving V8 right now. One thing I noticed though while doing SS pagination is that the getCanNextPage only uses the row count of the client side rows, meaning if you're attempting to handle pagination server side, this function will likely return false.
Instead I think it should use the pageCount if the pageCount is provided by the implementer.
File: packages/table-core/src/features/Pagination.ts
getCanNextPage: () => {
const { pageIndex, pageSize } = instance.getState().pagination
const pageCount = instance.getPageCount()
if (pageCount === -1) {
return true
}
if (pageCount === 0) {
return false
}
// Instead of calculating here, just rely on pageCount.
return (
pageIndex < pageCount - 1
)
},
I can create a PR for this if you think it makes sense to change, would love to contribute to one of your repos.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello again, loving V8 right now. One thing I noticed though while doing SS pagination is that the
getCanNextPage
only uses the row count of the client side rows, meaning if you're attempting to handle pagination server side, this function will likely return false.Instead I think it should use the
pageCount
if thepageCount
is provided by the implementer.File:
packages/table-core/src/features/Pagination.ts
I can create a PR for this if you think it makes sense to change, would love to contribute to one of your repos.
Beta Was this translation helpful? Give feedback.
All reactions