Skip to content

Improve ShadCN DataTable to Support Server-Side Pagination with Inertia #1

@ammodev

Description

@ammodev

Is your feature request related to a problem?

ShadCN provides a DataTable component, but it assumes all data is available on the client side. However, Laravel's pagination system only returns a chunk of data (e.g., 30 items at a time) along with links for navigation (previous, next, first, last). This makes it difficult to integrate the DataTable seamlessly with an Inertia.js setup that relies on server-side pagination.

Describe the solution you'd like.

The ShadCN DataTable should support server-side pagination when used with Inertia.js. Specifically:

  • It should be able to fetch and display paginated data dynamically.
  • The pagination controls should work with Laravel’s response format (handling links for navigation).
  • Sorting and filtering should also be compatible with backend-driven queries rather than client-side-only operations.

Describe alternatives you've considered.

  • Manually modifying the existing ShadCN DataTable to fetch data from the server, but this requires significant custom logic.
  • Using third-party table libraries like React Table, but this requires additional styling and does not integrate well with ShadCN.
  • Implementing a custom table component from scratch, but this is time-consuming and defeats the purpose of using ShadCN.

Other

A working example or an official guide on handling server-side pagination with ShadCN and Inertia would also be helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: acceptedDisputed bug is accepted as valid or Feature accepted as desired to be added.

    Projects

    Status

    Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions