Json Table
This module wraps the Paginated Table module with a component that fetches data from the given URL and expects the response to be in the same format as Laravel's paginator json output.
ID | Name | Role | Status | Created | |
---|---|---|---|---|---|
1 | Alice Johnson | [email protected] | Admin | Active | 2024-01-15 |
2 | Bob Smith | [email protected] | User | Active | 2024-02-20 |
3 | Carol Williams | [email protected] | Editor | Active | 2024-03-10 |
4 | David Brown | [email protected] | User | Inactive | 2024-04-05 |
5 | Eve Davis | [email protected] | User | Active | 2024-05-12 |
Installation
Usage
This usage example loads data via JSON fetch requests. To load data via Inertia requests see the Paginated Table Module.
Optionally seed your database with test data to see the pagination in action:
artisan tinker
\App\Models\User::factory(100)->create();
Props
JsonTable
Prop | Type | Description |
---|---|---|
url | string | The endpoint URL to fetch paginated data from |
columns | JsonTableColumn[] | Array of column definitions with key and label properties |
paginationType | "simple" | "numeric" (optional) | The pagination style to use (defaults to "numeric" ) |
formatCell | (key: string, value: any) => string | number (optional) | Optional function to format cell values before display |
JsonTableColumn
Prop | Type | Description |
---|---|---|
key | string | The key in the data object to display |
label | string | The column header label |