Skip to main content
Tutorial Free

Filament Table Row Click: Open Modal Window View

October 29, 2023
2 min read

Filament Table has a feature of clicking on the row and landing on the Edit page. What if you want to change that and instead open a modal with the record data? Let's do that using Table Actions.

modal view


By default, the table row has a link. First, we must disable the link by setting recordUrl to null in the table.

class PostResource extends Resource
{
// ...
 
public static function table(Table $table): Table
{
return $table
->columns(...)
->filters(...)
->actions(...)
->bulkActions(...)
->recordUrl(null);
}
 
// ...
}

Now, a method recordAction is used to set the action for a whole row. In this method, we can pass a View Action class.

use Filament\Tables;
 
class PostResource extends Resource
{
// ...
 
public static function table(Table $table): Table
{
return $table
->columns(...)
->filters(...)
->actions(...)
->bulkActions(...)
->recordAction(Tables\Actions\ViewAction::class)
->recordUrl(null);
}
 
// ...
}

And now, when clicked on a row, the view action will be called, and a modal with a records view will be opened.

Notice: don't forget that when creating a Resource, you also need to create a View. If you forgot to create, you can create a View to an existing Resource.


If you want more Filament examples, you can find more real-life projects on our FilamentExamples.com.

Enjoyed This Tutorial?

Get access to all premium tutorials, video and text courses, and exclusive Laravel resources. Join our community of 10,000+ developers.

Recent Courses

Comments & Discussion

TF
Thomas Freier ✓ Link copied!

Hello,

is it also possible to add an EditAction (Header or Footer) in the ViewAction? Thanks

BR Thomas

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.