Skip to content

feat: implement cursor-based pagination in DataTable#1382

Open
vinitkhandal717 wants to merge 4 commits intodevfrom
1304-datatable-request-for-cursor-based-pagination-feature-in-datatable
Open

feat: implement cursor-based pagination in DataTable#1382
vinitkhandal717 wants to merge 4 commits intodevfrom
1304-datatable-request-for-cursor-based-pagination-feature-in-datatable

Conversation

@vinitkhandal717
Copy link
Copy Markdown
Collaborator

@vinitkhandal717 vinitkhandal717 commented May 5, 2026

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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 5, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@juspay/blend-design-system@1382

commit: a75847d

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 unified onPageChange handler type.
  • Updates DataTable footer/pagination components to render either page-number UI or cursor next/prev UI based on paginationMode.
  • Updates the site demo to showcase cursor pagination usage and adjusts page-mode onPageChange usage 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.

Comment thread packages/blend/lib/components/DataTable/TableFooter/index.tsx Outdated
Comment thread packages/blend/lib/components/DataTable/DataTablePagination.tsx
Comment thread packages/blend/lib/components/DataTable/DataTablePagination.tsx
Comment thread packages/blend/lib/components/DataTable/DataTablePagination.tsx
Comment thread packages/blend/lib/components/DataTable/DataTable.tsx
Comment thread packages/blend/lib/components/DataTable/DataTablePagination.tsx
Comment thread packages/blend/lib/components/DataTable/DataTablePagination.tsx
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.

Comment thread packages/blend/lib/components/DataTable/DataTable.tsx
Comment thread packages/blend/lib/components/DataTable/TableFooter/index.tsx Outdated
Comment thread packages/blend/lib/components/DataTable/DataTablePagination.tsx
Comment thread packages/blend/lib/components/DataTable/DataTablePagination.tsx
Comment thread packages/blend/lib/components/DataTable/DataTablePagination.tsx
Comment thread packages/blend/lib/components/DataTable/DataTable.tsx
Comment thread packages/blend/lib/components/DataTable/types.ts
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Comment thread packages/blend/lib/components/DataTable/types.ts
Comment thread packages/blend/lib/components/DataTable/DataTablePagination.tsx
Comment thread packages/blend/lib/components/DataTable/DataTablePagination.tsx Outdated
Comment thread packages/blend/lib/components/DataTable/DataTablePagination.tsx
Comment thread packages/blend/lib/components/DataTable/TableFooter/index.tsx Outdated
Comment thread packages/blend/lib/components/DataTable/DataTable.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DataTable]: Request for cursor based pagination feature in DataTable

2 participants