F
Filament15mo ago
Crylar

Is it possible to change action on row click?

I was wondering if it's possible to trigger another action when user clicks on a row? e.g. I would like to have view action instead of edit action on row click.
10 Replies
Brian Kidd
Brian Kidd15mo ago
Check the docs
Dan Harrin
Dan Harrin15mo ago
if you have a ViewAction defined in the table we will use that one by default anyway
Crylar
Crylar15mo ago
Hm, I did not but I will try. I did not think about it. 🙂 Is there a way to have view open as modal? Right now it opens as a separate page.
toeknee
toeknee15mo ago
Remove the linkage to the table with the page class
Dennis Koch
Dennis Koch15mo ago
Don't have a ViewPage and it will open in a modal
Crylar
Crylar15mo ago
What about opening a modal on row clicking? I am in a chicken and egg race here. I thought I can use view as a modal when user clicks on a row but then view does not allow to edit anything, and I have some toggle actions that I want to allow user to change.
Dennis Koch
Dennis Koch15mo ago
You can overwrite the row action on the List Page. Something like getRowRecordAction or similar
Crylar
Crylar15mo ago
php
protected function getTableRecordActionUsing(): ?Closure
{
return fn (): string => 'view';
}
php
protected function getTableRecordActionUsing(): ?Closure
{
return fn (): string => 'view';
}
So I have managed to override this using but for this I need to remove
'edit' => Pages\EditOrder::route('/{record}/edit'),
'edit' => Pages\EditOrder::route('/{record}/edit'),
The problem now is that when I click edit button, the edit opens in a modal.
Dan Harrin
Dan Harrin15mo ago
you need an edit page defined in the getPages()
Crylar
Crylar15mo ago
yeh but then getTableRecordActionUsing is not working anymore, when I click on row it opens in edit
protected function getTableRecordActionUsing(): ?Closure
{
return fn (): string => 'view';
}

protected function getTableRecordUrlUsing(): ?Closure
{
return null;
}
protected function getTableRecordActionUsing(): ?Closure
{
return fn (): string => 'view';
}

protected function getTableRecordUrlUsing(): ?Closure
{
return null;
}
Okay, this works. 🙂
Want results from more Discord servers?
Add your server
More Posts
Set table row limit in testsHeyo. Not sure if there are questions for this already, couldn't see any but my search terms might nIs it possible to enable particular component during view?I have tried to do ``disabled(false)`` but the component remains disabled. Is it possible to overridHow to customise title in SelectFilter loaded via relationship?I have the following filter and would love to concat ``title`` with ``prefix`` field. How it's possiIs it possible to hide some form elements when calling via view action?I would like to somehow detect that form was loaded by using view action and modity the form layout Key value column implementation for settings tableI have settings table with two columns `key and value` . I want a setting resource to set multipleWhat are my options to use repeater component as collapsible element inside table?I would like to have products listed inside collapsible panel on a table with some actions attached How can I update a form input on action?I have action button on edit page and would like to update a particular input on edit form. How can File Attachment Does Not Exist on Media Library Plugin/Form BuilderHi, I don't understand why I get "File Attachment Does Not Exist" . I am using Spatie Media LibraryImage ValidationHi, I'm using fileupload, and wanted to validate the image height and width(using max or min height Default sort direction for a column - descending firstTo improve the UX I wanted to change how the ‘Updated at’ timestamp are sorted descending on first c