feat: implement cursor-based pagination in DataTable#1382
Open
vinitkhandal717 wants to merge 4 commits intodevfrom
Open
feat: implement cursor-based pagination in DataTable#1382vinitkhandal717 wants to merge 4 commits intodevfrom
vinitkhandal717 wants to merge 4 commits intodevfrom
Conversation
commit: |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds cursor-based pagination support to the DataTable component to enable next/previous navigation for APIs that don’t provide total record counts, while preserving existing page-index pagination.
Changes:
- Introduces cursor pagination types/config (
CursorPaginationConfig,CursorDirection) and a unifiedonPageChangehandler type. - Updates
DataTablefooter/pagination components to render either page-number UI or cursor next/prev UI based onpaginationMode. - Updates the site demo to showcase cursor pagination usage and adjusts page-mode
onPageChangeusage to the new handler signature.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
packages/blend/lib/components/DataTable/types.ts |
Adds cursor pagination types, unified pagination config union, and updated onPageChange typing. |
packages/blend/lib/components/DataTable/TableFooter/types.ts |
Updates footer prop types to accept the unified pagination config and handler. |
packages/blend/lib/components/DataTable/TableFooter/index.tsx |
Adjusts footer rendering behavior for cursor mode (including empty-data behavior). |
packages/blend/lib/components/DataTable/DataTablePagination.tsx |
Implements cursor-mode UI/behavior in the pagination control and refactors page-size handling. |
packages/blend/lib/components/DataTable/DataTable.tsx |
Wires paginationMode/legacy flag into DataTable and updates footer integration + onPageChange behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…-datatable-request-for-cursor-based-pagination-feature-in-datatable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
implement a cursor based pagination
<DataTable
paginationMode="cursor"
pagination={/* CursorPaginationConfig */}
onPageChange={(pageOrCursorDirection, cursorPayload, limit) => { ... }}
/>
Required DataTable props for cursor mode
paginationMode="cursor"
pagination (CursorPaginationConfig):
limit: how many rows to fetch each time
hasNextPage / hasPrevPage: booleans from your API
one of these to tell the table what to send back to you:
nextCursor / prevCursor (most common), or
cursor (single shared token), or
cursorParams (object payload if your API needs multiple fields)
optional: limitOptions for the “rows per page” dropdown
onPageChange(direction, cursorPayload?, limit?)
When user clicks Next/Prev, you’ll get:
direction: CursorDirection.NEXT or CursorDirection.PREV
cursorPayload: whatever you put in nextCursor/prevCursor/cursor/cursorParams
limit: the limit for that request
Issue Ticket
Closes #1304