Table Action Url() on Column

So i have an Action that I use in a bunch of different places and how it behaves is based on an app config. So I have a table and i have the action used on the first column of the table and the action at the end of the table. Now for troubleshooting purposes, ive simplified it down down to this
TextColumn::make('name')
->action(
\Filament\Tables\Actions\Action::make('view_property')
->url(function ($record): string {
return route('properties.show', $record->id);
})
),
TextColumn::make('name')
->action(
\Filament\Tables\Actions\Action::make('view_property')
->url(function ($record): string {
return route('properties.show', $record->id);
})
),
, which fails to launch there, but fine again in actions(). Ive tried changing the action name, no difference. When i click on it, its sending a network request, but not performing the action of going to the url. Since its a url(), shouldnt even show the address on hover, which its not?
5 Replies
Mark Chaney
Mark ChaneyOP2y ago
As mentioned, its an app configuration and in my custom action, when its set to open a modal instead of using the url(), the modal works fine. So its simply a case of an Action with url() set where its not working im assuming because a column has a url() option by default?
cheesegrits
cheesegrits2y ago
I suspect so, although I haven't walked thru the code.
Mark Chaney
Mark ChaneyOP2y ago
hmm, grr. that woudl really cause a problem for me
awcodes
awcodes2y ago
Would be my first guess too. Does the html output have an a tag or a button?
Mark Chaney
Mark ChaneyOP2y ago
button I dont like it, but this works
->action(
ViewPropertyAction::make('view_property')
)
->url(function ($record) {
if (config('platform.view_property_action') === 'modal') {
return;
}

return route('properties.show', $record->id);
})
->action(
ViewPropertyAction::make('view_property')
)
->url(function ($record) {
if (config('platform.view_property_action') === 'modal') {
return;
}

return route('properties.show', $record->id);
})
as that limits things a abit and doesnt make my ViewPropertyAction the single source for how things are handled

Did you find this page helpful?