Websocket - refresh table
I've been trying to find a way to refresh a table, or a specific row in a table using websockets. Say there's an event in a different module that would affect the data in the table, i'd like to re-fetch the data or only the row that was affected. Has anyone encounter something like this?
5 Replies
Hmm I've done something similar, but my solution was not pretty...
Essentially you need to figure out which records you have on the table, and only update if an event is for any of these ids
Let me see if I can find the snippets
So I created a 'custom' view like this
And in my component I did
There are probably better ways to do this but hope it helps you
Thank you @ChesterS, I'll take a look!!
Honestly, it might be better if you use polling π
btw this uses websockets. If all you want to do is refresh a table when something happens somewhere else in the same page, you can just use normal events (https://livewire.laravel.com/docs/events)
Oh that works better!!!
That's awesome