Displaying a modal after action has been performed
Hi - I want to create a table action (like add it on each row) where a user clicks on a button, it performs an action (connection-check in this case) which returns either true or false. Afterwards I want to see a modal with either "success" or "failure". Now from what I get so far, I can create modals BEFORE an action has been performed (like confirmation modals or form-modals), but how do I do that AFTERWARDS? I could do the workarround by opening a modal, adding a button and update said modal, but that is not elegant enough for me. Is there a way to do it like "click button" -> "perform action" -> "show modal with content concering the action-result"?
Thanks in advance. 🙂
Solution:Jump to solution
Okay - here is what I ended up with:
```
Tables\Actions\Action::make('checkConnection')
->label('Verbindung prüfen')
->button()...
18 Replies
Okay - I was able to stich something together by utilizing the ->form-function and mountUsing.
Only problem left is that I had to add an action there for the modal to even show up and now there is a "Submit"-Button. If someone has an idea on how to suppress that, that would actually do the trick. 🙂
What I have so far:
Are you using Tables outside or tables inside the admin panel?
inside
Isn't this the purpose of notifications? IIRC notifications alignment can be changed to center the notifications, making it look like a modal?
Exactly what I was going to say @ZedoX this is the exact usecase of Notifications
okay @toeknee and @ZedoX - Thanks for that input. 🙂
But how would I have to modify my code (see above) so send that Notification inside a table-action?
Something like this? I need a starting-point of sort... 😅
Exactly
You cn then do a update on that action too to check it in the db
And do you know how to center it like @ZedoX said? Cause I need that only for that one specific notation and not globally...
You can't as far as I am aware at present. Personally, all notifications / notifiable actions from a UX perspective should be in the same place
Solution
Okay - here is what I ended up with:
Thanks @toeknee and @ZedoX. 🙂
Welcomes!
Can you mark my last message as solution please? I don't see the Apps-submenu in Discord...
You can hover and click the three dots
checking
@Dennis Koch - Thank you! Is there something up with the Bot?
Ahh it's a app version issue, update discord and it should come back
Ah - thanks! Works now. 🙂
Gotta love the Filament-Helpers. 😁