Is there anyway to reload RelationManager Owner page with Spa mode?
In my CreateAction of the RelationManager, I have update some ower model data, I then want it to refresh. The code here I use rediret to refresh it. I would like to just reload the form or load it in spa mode. Is there any way to do that? #relationmanager #ownerpage
Solution:Jump to solution
- add an event in the Edit/View Page
https://livewire.laravel.com/docs/events#listening-for-events
- dispatch in your action
$livewire->dispatch('refresh-page');
...4 Replies
Im sorry for not answering your question . But im admire on your layout . Very simple and nice looking . Is there by any chance i want to see how you design like that? Im still new in filment . If you okay maybe can share to me in dm probaby?
Solution
- add an event in the Edit/View Page
https://livewire.laravel.com/docs/events#listening-for-events
- dispatch in your action
$livewire->dispatch('refresh-page');
Hi Leandro. Do I have to create a custom view for parrent page in order to put javascript to listen to the dispatch event?
I got it now.
for other noobs like me that find this thread, this is how I applied it to my case:
I have a Resource with a RelationManager. The Resource's ViewPage has a HeaderAction that updates the Resource's status.
Based on this status, the RelationManager should also change, but it normally takes a page reload to see those changes.
To trigger the page reload, I added
$this->dispatch('status-updated');
to the HeaderAction in the ViewPage.
Then back in the RelationManager, I added #[On('status-updated')]
right before the class ExampleRelationManager extends RelationManager
and after the imports.
You gotta import use Livewire\Attributes\On;
as well.