Download the PHP package bostos/reorderable-columns without Composer
On this page you can find all versions of the php package bostos/reorderable-columns. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bostos/reorderable-columns
More information about bostos/reorderable-columns
Files in bostos/reorderable-columns
Package reorderable-columns
Short Description This is my package reorderable-columns
License MIT
Homepage https://github.com/bostos/reorderable-columns
Informations about the package reorderable-columns
Reorderable Columns
Reorderable Columns is a plugin for Filament that allows users to reorder table columns via drag-and-drop. The new column order can be saved either in the session or persisted in the database (per user).
Features
- Intuitive Drag & Drop: Easily reorder table columns to create your preferred layout
- Persistent Ordering: Column order is saved and automatically reapplied on next visit
- Flexible Storage Drivers:
- Database: Persist layouts per-user, so everyone gets their own custom view
- Session: Keep the layout for the current session, resetting on logout
- Seamless Integration: Designed to feel like a native Filament feature
- Smart Column Handling:
- Remembers the order of visible columns
- Automatically places newly added columns at the end of the table
📦 Installation
Install the package via Composer:
Then, publish and run the migrations to create the reorderable_columns_orders
table:
Optionally, publish the configuration file:
⚙️ Usage
Step 1: Register the Plugin in Your Panel Provider
In your AdminPanelProvider.php
(or another panel provider), register the plugin inside the panel()
method. You can choose the persistence strategy:
persistToSession()
(default) – Saves order in the session (lost on logout).persistToDatabase()
– Persists per-user column order in the database.
Step 2: Use the Trait in Your ListRecords Page
In your ListRecords page class (e.g. app/Filament/Resources/UserResource/Pages/ListUsers.php
), use the HasReorderableColumns
trait and override the $view
property.
💡 Don't forget to create the custom view in Step 4.
Step 3: Enable Reordering on Your Table
In your resource file (e.g. UserResource.php
), chain the ->reorderableColumns()
method to your table definition. Provide a unique key (usually table or model name).
Step 4: Create a Custom Blade View
Since Filament’s table component doesn’t allow custom HTML attributes on the outer wrapper, you’ll need to override the view and wrap the table manually.
1. Create a custom view file
At the path defined in Step 2, create:
2. Copy the original view content
Copy the content from:
Paste it into your custom Blade file.
3. Wrap the table
Locate the line:
Wrap it in a div
with a data-reorderable-columns
attribute:
Make sure the value (users
) matches the key passed in ->reorderableColumns()
.
📝 Changelog
Please refer to the CHANGELOG for details on recent changes.
🤝 Contributing
Contributions are welcome! Please see the CONTRIBUTING guide for details.
🔐 Security
If you discover a security vulnerability within this package, please send an e-mail to [email protected]. All security vulnerabilities will be promptly addressed.
🧠 Credits
⚖️ License
The MIT License (MIT). See the LICENSE file for more details.