How do I refresh my table when I interact with a ToggleColumn?
Is there an easy way to make ToggleColumn::make() reactive, or to get it to refresh the entire table after being toggled? I have other columns that depend on the state of these toggles, but I can't get the updates to the browser without refreshing the page manually.
I've tried things like $this->dispatch('$refresh') from different column callbacks, etc but without any luck. Adding <button wire:click="$refresh">Refresh component</button> to a button works, but I want the table to refresh when the toggle is toggled.
5 Replies
So I got the table to refresh by adding:
And then I call:
Which works now, but is there a way to accomplish this without the additional round trip?
don't know in this case but maybe just
$this->refresh()
could work?I thought I remembered that being a thing before too, but it says 'Method does not exist'. Was this once a livewire method? I don't see it in the current docs either.
I don't remember. I think I saw it in the filament source
So it ends up using a checkbox column is way more robust. Toggles get out of sync really fast if there is latency and you're updating other columns in the background.