FilamentF
Filament13mo ago
Jap

Reverb in Filament Tables

Instead of polling, How can i trigger an event to reload a specific table of a resource to reload ? I tried to register a script in AppServiceProvider and im having difficulty in getting the table component then refresh the component at the script. Is there is a better way to do this? Thanks.
Solution
Got the solution instead of finding the table in the javascript i added listener in ListPage or any livewire component files for example:
class ListTransactions extends ListRecords
{
    protected static string $resource = TransactionResource::class;

    protected $listeners = [
        'echo:channel-name,EventName' => '$refresh',
    ];
}


Then you can dispatch/broadcast events in actions like:
use App\Events\EventName;
 Tables\Actions\RestoreAction::make()
                        ->after(function ($record) {
                            EventName::dispatch();
                        }),
Was this page helpful?