Tricks

Emit Livewire event from Table Actions

Mar 2, 2023
Uzzair B
Table builder

To emit a Livewire event from table actions, simply pass a closure in the action() method. For instance, if you wish to open a modal or slide over using the Edit button in the table component, you can achieve this with ease;

use Filament\Tables\Actions\Action;
 
protected function getTableActions(): array
{
return [
Action::make('edit')
->action(function ($record) {
$this->emit('openModal', $record);
}),
];
}

No comments yet…