F
Filament2y ago
hgms

ViewAction on custom page

I created a custom page that's using the Table builder package with a ViewAction. When I click on view in the table, it pops open the modal but there's no content. I have the form schema defined but I can't for the life of me figure out how to connect the form with the ViewAction modal. Is this doable? Thanks.
7 Replies
Patrick Boivin
Can you share your getTableActions() ?
hgms
hgmsOP2y ago
protected function getTableActions(): array
{
return [
Tables\Actions\ViewAction::make(),
];
}
protected function getTableActions(): array
{
return [
Tables\Actions\ViewAction::make(),
];
}
In a filament resource the view form gets populated automagically from the form schema but in this case I'm not sure how to tell the ViewAction to use that.
Patrick Boivin
Ah I see! I thought you were having problems displaying the custom form. So this is about filling the form with the correct info when the modal opens?
Patrick Boivin
Filament
Actions - Table Builder - Filament
The elegant TALL stack table builder for Laravel artisans.
hgms
hgmsOP2y ago
Thanks, I'll give this a try! The modal does open but it's empty and I wasn't sure how to tell it to use my Form schema like it does in a filament resource. So it looks like the generic ViewAction doesn't work in a custom page, right?
Patrick Boivin
I think it works but indeed, there's probably not much difference between a ViewAction and a base Action in your context. The ViewAction will make all fields disabled by default...
hgms
hgmsOP2y ago
It does work and you pointed me in the right direction - thank you. I needed to attach the form to the action iteself
protected function getTableActions(): array
{
return [
Tables\Actions\ViewAction::make()->form([...]),
];
}
protected function getTableActions(): array
{
return [
Tables\Actions\ViewAction::make()->form([...]),
];
}
Bingo!
Want results from more Discord servers?
Add your server