karikas
How to trigger a Livewire component update after saving an Edit form?
Hi, I've been struggling with this for some time now and could sure use a nudge in the right direction. I have a Filament edit form with a layout that includes a Livewire component, being included like this in the Form schema:
What I would like to have happen is that when the form is saved it dispatches a refresh request to that component to refresh its data, as it displays several fields found in the form. I've been able to get it to work with an afterStateUpdated() on every related field in the Form, like this:
(note that is just updating one field due to some limitations I ran into trying to pass in the whole record)
...but I would much rather have one refresh defined in one place. I tried many, many variations in the UserEdit page php file, on the Action call itself and on the afterSave() event like this:
which doesn't work, those methods don't exist, and I've tried several other variations. I haven't found how to tap into properly dispatching an event to Livewire from this point.
My question is, am I even thinking about this the right way? I would think the user sees their edit form with this sidebar component on the side. They edit a few fields, hit Save to have those changes take effect, and then the sidebar should update. I would expect Filament has a trigger to dispatch a refresh of the Livewire component with the entire updated record data when a save Action is triggered.
Any suggestions would be greatly appreciated, thank you!
7 replies
Positioning a RelationManager inside a Form
Has anyone had success in moving a RelationManager inside the edit form, instead of displaying below it? I have tried a few approaches and found in GitHub discussions there was hope to do so using LiveWire's @teleport, but also a note that since this would be a form inside a form it isn't currently possible.
I would love to use the functionality of a RelationManager in our form... has anybody had success with this? If so, what was your approach? I've been using Filament for a few months now and love it, but am still getting up to speed with it.
5 replies