Download the PHP package sehsah/filament-remember-table without Composer
On this page you can find all versions of the php package sehsah/filament-remember-table. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sehsah/filament-remember-table
More information about sehsah/filament-remember-table
Files in sehsah/filament-remember-table
Package filament-remember-table
Short Description Save, name and switch between table views (filters, search, sort, columns, grouping) in Filament.
License MIT
Homepage https://github.com/sehsah/filament-remember-table
Informations about the package filament-remember-table
Filament Remember Table
Let your users save the way they like a Filament table (filters, search, sorting, grouping, visible columns) as named views, and switch between them in one click.
- Save the current table as a named view
- Switch views from a dropdown in the page header
- Update, rename, reorder and delete views
- Set a default view that opens automatically
- Define preset views in code
- Share a view with every user of the panel
- Shareable links: the active view lives in the URL (
?view=12) - Multi-tenancy aware
- English and Arabic translations, RTL friendly
Requirements
- PHP 8.2+
- Filament 5.x
Installation
The install command publishes the config and migration and asks to run the migration. You can also do it by hand:
Usage
Add the trait to a page that has a table (usually a resource's list page) and put the actions in the header:
That's it. A Views button appears in the page header.
Preset views
Views defined in code show up for everyone and can't be edited or deleted by users:
filters() takes the raw filter form state, keyed by filter name. For a SelectFilter or TernaryFilter that is ['value' => ...]; for a multiple SelectFilter it is ['values' => [...]]; for a custom filter it is whatever its form fields are named.
Other preset options: search(), tab() (a key from the list page's getTabs()), perPage() and key() (a stable id for the URL).
Several tables on one page
Views are stored per page class. If you reuse the same page class for different tables, override the key:
What is saved
| Part | Config key | Default |
|---|---|---|
| Filters | filters |
on |
| Global search | search |
on |
| Per-column searches | column_searches |
on |
| Sort column and direction | sort |
on |
| Grouping | grouping |
on |
| Column visibility and order | columns |
on |
| List page tab | tab |
on |
| Records per page | per_page |
off |
Turn parts on or off in config/remember-table.php under remember.
Saved views are validated when they are applied: filters, columns, groups and tabs that no longer exist on the table are ignored, and columns you added after a view was saved still show up.
Configuration
How it behaves
- Default view: applied when a user opens the table, unless the URL already has table state (
?filters=,?search=,?sort=,?tab=...), so links to a filtered table keep working. - Modified indicator: after applying a view, changing the table shows
View name (modified)on the button, and Update current view appears for views the user owns. - Shared views: other users can apply them, and they are labelled Shared. Only the owner can update, rename or delete them.
- Reset table: clears the active view and puts the table back to its defaults.
Customizing the actions
Each action is a normal Filament action. To tweak one, alias the trait method and wrap it:
Available: saveTableViewAction(), updateTableViewAction(), manageTableViewsAction(), resetTableViewAction().
Testing
Roadmap
- Team-level sharing (share with specific roles or users)
- Record count badges on views
- Views as tabs above the table
- A panel page listing all views
- Import / export views as JSON
Changelog
See CHANGELOG.
License
The MIT License (MIT). See License File.