F
Filament•16mo ago
Mark Chaney

Update Modal Heading

I am using modalContent() to load a view with some dynamic data and currently have the ability to switch records from with that same modal. The only thing i havent figured out was updating the modalheading() of the existing modal that i am in.
2 Replies
ZedoX
ZedoX•16mo ago
Did you try passing in a closure? not sure if that would work I think heading is evaluated when the modal opens 🤔
Mark Chaney
Mark ChaneyOP•16mo ago
I did not as that was my assumption as well. I don’t see it set anywhere in $livewire, which is where I assumed it would be located Now on my phone, but was up to 7am coding, so might wasn’t that clear at the time. lol So looks like i can do something like
->modalHeading(function ($record) {
return $this->modalRecord ? $this->modalRecord->display_name : $record->display_name;
})
->modalHeading(function ($record) {
return $this->modalRecord ? $this->modalRecord->display_name : $record->display_name;
})
and then use a emit/listener to update that modalRecord property, but its a slower than i would would prefer and i swear there has to be a better way. Guess I need to update to laravel 10/LW3 as i think there are better options. hmm, that $modalRecord woudl have to be reset on close of that modal too or future row actions would use that. Not ideal
Want results from more Discord servers?
Add your server