F
Filamentβ€’9mo ago
ConnorHowell

Default clickable row action

I've got a resource with both edit & view actions on the table row; I've tried overriding the default click action using the 'recordAction' method but it still defaults to view instead of edit. Here's the table method, I can't tell if I'm being stupid/missing something glaringly obvious πŸ˜…
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('name')
->searchable()
->sortable()
])
->paginated(false)
->filters([
//
])
->recordAction('edit')
->actions([
Tables\Actions\EditAction::make(),
Tables\Actions\ViewAction::make(),
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('name')
->searchable()
->sortable()
])
->paginated(false)
->filters([
//
])
->recordAction('edit')
->actions([
Tables\Actions\EditAction::make(),
Tables\Actions\ViewAction::make(),
]);
}
Solution:
```php public static function table(Table $table): Table { return $table ->columns([...
Jump to solution
3 Replies
ConnorHowell
ConnorHowellβ€’9mo ago
Nevermind, figured it out. The View action was linking to a url so the default recordUrl logic was overriding recordAction and linking to a URL instead of running the action. Essentially the fix is to just pass null as the URL and it will use the action instead:
Solution
ConnorHowell
ConnorHowellβ€’9mo ago
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('name')
->searchable()
->sortable()
])
->paginated(false)
->filters([
//
])
->recordAction('edit')
->recordUrl(null)
->actions([
Tables\Actions\EditAction::make(),
Tables\Actions\ViewAction::make(),
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('name')
->searchable()
->sortable()
])
->paginated(false)
->filters([
//
])
->recordAction('edit')
->recordUrl(null)
->actions([
Tables\Actions\EditAction::make(),
Tables\Actions\ViewAction::make(),
]);
}
arne_becker
arne_beckerβ€’5mo ago
Oh wow. I'm having a silimar issue. Is there something like a default action for the row/record? However, I didn't found the recordAction() in the docs. I would like to open the record in a Infolist Slideover when I click the row. I don't want to have the View Action Button in the Action Column. And I would like to be able to open the Edit Page with the a Button in the Action Column. The infolist() method existins in the Ressouce class, of course. Currently, it seems only possible when I add the View Action to the actions() method. But then I get the Action in the Actions columns.