Preparing your Livewire component
Implement theHasTable interface and use the InteractsWithTable trait:
getTableQuery() method:
Pagination
By default, tables will be paginated. To disable this, you should override theisTablePaginationEnabled() method on your Livewire component:
getTableRecordsPerPageSelectOptions() method on your Livewire component:
page parameter of the URL query string. If you have multiple tables on the same page, this will mean that the pagination state of one table may be overwritten by the state of another table.
To fix this, you may define a getTableQueryStringIdentifier() on your component, to return a unique query string identifier for that table:
Simple pagination
You may use simple pagination by overridingpaginateTableQuery() method on your Livewire component:
Searching records with Laravel Scout
While Filament doesn’t provide a direct integration with Laravel Scout, you may override methods to integrate it with your Livewire component. First, you must ensure that the table search input is visible:whereIn() clause to filter the query for Scout results:
whereIn() method to retrieve results internally, so there is no performance penalty for using it.
Clickable rows
Record URLs
You may allow table rows to be completely clickable by overriding thegetTableRecordUrlUsing() method on your Livewire component:
posts.edit route.
If you’d like to override the URL for a specific column, or instead run a Livewire action when a column is clicked, see the columns documentation.
Record actions
Alternatively, you may configure table rows to trigger an action instead of opening a URL:EditAction or another action with the name edit exists on the table row, that will be called. If not, a Livewire public method with the name edit() will be called, and the selected record will be passed.
Disabling clickable rows
If you’d like to completely disable the click action for the entire row, you may override thegetTableRecordActionUsing() method on your Livewire component, and return null:
Record classes
You may want to conditionally style rows based on the record data. This can be achieved by specifying a string or array of CSS classes to be applied to the row using thegetTableRecordClassesUsing() method:
content configuration in tailwind.config.js to also scan for classes in your desired PHP files:
Empty state
By default, an “empty state” card will be rendered when the table is empty. To customize this, you may define methods on your Livewire component:Query string
Livewire ships with a feature to store data in the URL’s query string, to access across requests. With Filament, this allows you to store your table’s filters, sort, search and pagination state in the URL. To store the filters, sorting, and search state of your table in the query string:Reordering records
To allow the user to reorder records using drag and drop in your table, you can use thegetTableReorderColumn() method:
getTableReorderColumn() method returns the name of a column to store the record order in. If you use something like spatie/eloquent-sortable with an order column such as order_column, you may return this instead:
Enabling pagination while reordering
Pagination will be disabled in reorder mode to allow you to move records between pages. It is generally bad UX to re-enable pagination while reordering, but if you are sure then you can use:Polling content
You may poll table content so that it refreshes at a set interval, using thegetTablePollingInterval() method:
Using the form builder
Internally, the table builder uses the form builder to implement filtering, actions, and bulk actions. Because of this, the form builder is already set up on your Livewire component and ready to use with your own custom forms. You may use the defaultform out of the box: