ViewAction on resource's table listing page
Hi,
I have a model Estimate that has relationship to other model User. I want from ListEstimate page to have action that will open user info in a modal window (slideover). How to achive that? What I tried so far didn't work:
Solution:Jump to solution
I've manage to find the solution to my problem using
mountUsing()
method on an action by inspecting how ViewAction works in the Filament. This is my solution:
```php
Tables\Actions\Action::make('view-linked-user')
->label('Show user')...4 Replies
Oh yes and I also tried to use Filament\Actions\ViewAction instead of Filament\Tables\Actions\ViewAction but that didn't work either. If I use Filament\Tables\Actions\ViewAction, when clicking on, it opens view estimate page (I want to open user linked to estimate) and if I use Filament\Actions\ViewAction then nothing happens when clicking the button.
Can anyone help please?
you need modelcontent
For information about modal in action look at this page https://filamentphp.com/docs/3.x/actions/modals
I do not want to create separate view as I already have User resource view page. I would like to display user view in a modal from Estimate listing page. If that make sense to you.
I can use table's ViewAction to open User on the ListUsers.php page. I would like to open a modal to view user details on the ListEstimate.php page. The estimate is linked to a user.
Solution
I've manage to find the solution to my problem using
mountUsing()
method on an action by inspecting how ViewAction works in the Filament. This is my solution:
In my form()
method I am calling my custom class UserForm
that define fields for this action and for my UserResource
class.