Refresh table widget in dashboard after success create record using action
How can i achieve to refresh the table only after i create record using action, i mean, i can using poll in my table widget but, its kinda annoying when u always request, so i think that would be better its only update after i success create the record via modal action
thank you.
4 Replies
If you create a record through an action on the table, it should refresh automatically π€
If not, you could dispatch an event and listen for it in the table page/component. Something like
$this->dispatch('something-created')
and then listen for that event with #[On('something-created')]
on top of the classno it dont, as i said, im using Action. not table action, so in my dashboard, i use extend the dashboard and add the getHeaderActions and put the action over there, and not table action, also the name space using
then i create table-widget, so when i run the action from dashboard file i want the table-widget refresh, but as default it doesnt, i already try the dispact way before, but still same ππ. i can achieve to refresh the table using poll, but still, im feeling it just not right, or maybe thats the way but im not sure about it, so if there is another way to achieve i mean the good way, thats wht im looking for...
anyways, thank for ur answer man
An event should work. If you dispatch an event and put either
it should refresh the table. (there are other ways to achieve this but this is pretty simple/straightforward)
fantastic, you save me β€οΈ