F
Filamentβ€’12mo ago
Jon Mason

Open modal from edit table action

How can I open a modal from the edit action of a table row. I want to have a slide-over where I can edit the record. I have this in my table actions:
->actions([
Action::make('edit')
->action(fn (StatementTransaction $transaction) => $this->dispatch('open-modal', id: 'edit-transaction')
]);
->actions([
Action::make('edit')
->action(fn (StatementTransaction $transaction) => $this->dispatch('open-modal', id: 'edit-transaction')
]);
It doesn't do anything, and I also need to pass a parameter. I have a Livewire component for the edit transaction modal, so I'd ideally like to open that when the row is clicked, unless there's an easier magic way to edit table rows in a modal. Can't seem to find anything in the docs that would allow me to do this, but I feel like it should be possible. I've also tried:
Action::make('edit')
->icon('heroicon-m-pencil-square')
->iconButton()
->modalContent(fn (StatementTransaction $transaction): View => view('livewire.components.statements.edit-statement-transaction', ['transaction' => $transaction]))
->slideOver()
Action::make('edit')
->icon('heroicon-m-pencil-square')
->iconButton()
->modalContent(fn (StatementTransaction $transaction): View => view('livewire.components.statements.edit-statement-transaction', ['transaction' => $transaction]))
->slideOver()
Solution:
The last bit of my question seems to be how to do it based on this github discussion: https://github.com/filamentphp/filament/discussions/7529 but it's not working....
GitHub
How to show livewire component as modal window for filament table a...
I am going to show a livewire component in modal window when user clicks a filament table action. protected function getTableActions() { return [ ActionGroup::make([ ViewAction::make()->form([ T...
Jump to solution
7 Replies
einnlleinhatt_
einnlleinhatt_β€’12mo ago
Try comment the edit page in the resources.
Jon Mason
Jon MasonOPβ€’12mo ago
It's not in a resource, it's a livewire component
Solution
Jon Mason
Jon Masonβ€’12mo ago
The last bit of my question seems to be how to do it based on this github discussion: https://github.com/filamentphp/filament/discussions/7529 but it's not working.
GitHub
How to show livewire component as modal window for filament table a...
I am going to show a livewire component in modal window when user clicks a filament table action. protected function getTableActions() { return [ ActionGroup::make([ ViewAction::make()->form([ T...
Jon Mason
Jon MasonOPβ€’12mo ago
bump...if anyone can possibly help me out on this, I'd greatly appreciate it.
Bene Richi
Bene Richiβ€’12mo ago
I am stuck here aswell. I have a toggleColumn on a table and when I toggle it I would like to show a confirmation modal. Will let you know when I have found out something. I already created a new action but its not necessary as it seems because a new action is like adding a "new button" to the frontend.
Jon Mason
Jon MasonOPβ€’12mo ago
@BeneRichi | Reefaq.io If you look at the github link I posted, Dan chimed in there and helped me figure out my issue. May not work for your case, but I was able to use the built in EditAction for mine and it worked flawlessly.
Bene Richi
Bene Richiβ€’12mo ago
Thanks Jon, I will once take a look again πŸ™‚
Want results from more Discord servers?
Add your server