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:Jump to 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;...
7 Replies
Pretty sure it can be done via livewire (You dont need reverb/websockets). Try the following:
In your class file (where the table is):
You can fire this event from anywhere
Thanks for that, but at this case i want other users table in that same page is reloaded that's why i am trying to use reverb/websockets.
Ohhhh, yeah, then indeed you would have to use websockets. Not sure how you do that though. My guess is you follow the guide on how to set up Reverb/websockets, and whenever you fire the event you run
$this->resetTable()
I made reverb running by using this line of code in AppServiceProvider:
At reverb.js the problem was finding the table at echo channel like this:
Assuming you have setup reverb correctly
in JS
Hmm, i think that will affect all tables in any page? Just want to trigger it on a specific table .
Solution
Got the solution instead of finding the table in the javascript i added listener in ListPage or any livewire component files for example:
Then you can dispatch/broadcast events in actions like: