F
Filamentβ€’7mo ago
Skrypt

Dynamic actions with modal

Hi, how can I create dynamically Actions in a custom page, where each of the actions opens a modal? When I did some testing, it worked if I just created a method like testAction() { // return action } ANd rendered it using {{ $this->testAction }}. However when creating them dynamically (based on an array of records for example that can change), it stops working. The action is rendered, but modals don't open anymore. I guess it has something to do with the internals of the InteractsWithActions trait and how the mounted actions / modals are stored, but is there any way to enable this in current filament version?
1 Reply
Skrypt
SkryptOPβ€’7mo ago
Basically currently I have a method which returns a dynamically created array of Actions, it can be any amount of Actions.
I group them inside an Action Group and then render it using a for loop. They get rendered, but modals don't work anymore. So I currently fixed it by rendering the modals manually using the Blade Component Library of Filament and then overriding each action by adding a alpineClickHandler to it, to call my manually created modals. If anyone knows a better solution, I'd be happy to hear it πŸ™‚
Want results from more Discord servers?
Add your server