xentixar / dynamic-table
v1.0.2
2026-05-11 11:25 UTC
Requires
- filament/tables: ^4.0 || ^5.0
- illuminate/support: ^11.0 || ^12.0 || ^13.0
README
xentixar/dynamic-table is a Filament package that adds dynamic table behavior.
Features
- Adds
Table::liveSelection()macro for reactive selection syncing. - Supports optional Livewire callback method execution on selection changes.
- Registers on both Filament Tables and Archilex Advanced Tables (if installed).
Requirements
- PHP 8.2+
- Filament Tables
^4.0 || ^5.0 - Illuminate Support
^11.0 || ^12.0 || ^13.0
Installation
Install with Composer:
composer require xentixar/dynamic-table
The package uses Laravel package discovery, so the service provider is auto-registered.
Quick Start
Apply liveSelection() on your table definition:
use Filament\Tables\Table; public static function table(Table $table): Table { return $table ->liveSelection(); }
Usage
1) Basic usage
public static function table(Table $table): Table { return $table->liveSelection(); }
2) Conditional enable/disable
public static function table(Table $table): Table { return $table->liveSelection( condition: auth()->user()?->can('bulkSelectUsers') ?? false, ); }
3) Use custom Livewire property
public static function table(Table $table): Table { return $table->liveSelection( livewireProperty: 'selectedUsers', ); }
4) Trigger a Livewire method on selection change
public static function table(Table $table): Table { return $table->liveSelection( livewireMethod: 'onSelectionChanged', ); } public function onSelectionChanged( array $selectedRecords, array $deselectedRecords, bool $isTrackingDeselectedRecords, ): void { // Your logic here }
If livewireMethod is not provided, the component refreshes automatically.
API Reference
condition(bool, default:true)- Enable or disable live selection behavior.
livewireProperty(string, default:selectedTableRecords)- Livewire property used for current selection state.
livewireMethod(?string, default:null)- Optional Livewire method called when selection changes.
- Receives
(array $selectedRecords, array $deselectedRecords, bool $isTrackingDeselectedRecords).
Troubleshooting
Method liveSelection does not exist:- Run
composer dump-autoloadand clear app caches (php artisan optimize:clear).
- Run
- Callback not firing:
- Ensure the method name in
livewireMethodmatches exactly and ispublic.
- Ensure the method name in
- Selection state not where expected:
- Verify the
livewirePropertyname matches your component property.
- Verify the
License
MIT
See LICENSE for full text.