Custom Page: open modal from link
Hey there.
I have a custom page
php artisan make:filament-page MyPage
. In there I want a link that once clicked, opens a modal.
This modal needs to go to the server and fetch something (so it's not just a JS modal).
How can I achieve this?
I've been wrestling with the docs to try and solve this for a while now.
The example makes no sense but if it works, I would be happy.
The button is shown but when clicked, the php request is fired but no modal appears with the response (code 200).
Am I missing something?7 Replies
From the docs,
You must use the InteractsWithActions and InteractsWithForms traits, and implement the HasActions and HasForms interfaces on your Livewire component class:
. Do you implement HasActions
and HasForms
?My custom page extends the
Filament\Pages\Page
who in turn extends the BasePage
that extends Livewire\Component
and implements those interfaces. It's enough, right?
Anyone?The code looks OK. Which version of Filament exactly?
it shouldn't be necessary if you are using panel builder.
This was supposed to work. Any console error?
I think I got it. In my code (not the one I put here) the action and the method had different names. That was causing the request to be made but no action taken.
I had something like this:
In the blade I need to call
$this->something
then in the Livewire component I need to have a somethingAction()
that has an Action::make('something')
inside. Right?What you have in your first example code is fine.
Thanks!