F
Filamentβ€’14mo ago
Chriis

How to disable clickable rows in a certain table tab

Hello, I have a 'Archived' tab for the table of one of my resources, and I would like to disable clicking on the row when I am in this tab. This produces a 404 error because the view/edit page is not found for the resource since it is soft-deleted. Is this possible ?
Solution:
With the method getUrl() of the resource its working. Thanks
Jump to solution
9 Replies
einnlleinhatt_
einnlleinhatt_β€’14mo ago
You can use recordUrl with record is trashed then return null
Chriis
ChriisOPβ€’14mo ago
Ok, but I'm not sure what name to use in the first argument of route(). I have an error when I follow the documentation logic 😬
Solution
Chriis
Chriisβ€’14mo ago
With the method getUrl() of the resource its working. Thanks
einnlleinhatt_
einnlleinhatt_β€’14mo ago
Sorry just got back.
->recordUrl(function ($record) {
if ($record->trashed()) {
return null;
}
->recordUrl(function ($record) {
if ($record->trashed()) {
return null;
}
Chriis
ChriisOPβ€’14mo ago
Yep, I've tried that but this is not working 😦 No errors but every row is unclickable even the one that are not trashed
Dennis Koch
Dennis Kochβ€’14mo ago
Makes sense because this code either retuns null or void
Chriis
ChriisOPβ€’14mo ago
But don't worry this is working
->recordUrl(fn (Sheet $record) => $record->trashed() ? null : self::getUrl('view', ['record' => $record]));
->recordUrl(fn (Sheet $record) => $record->trashed() ? null : self::getUrl('view', ['record' => $record]));
Ah yes
einnlleinhatt_
einnlleinhatt_β€’14mo ago
Oh yeah missed the return view, apologize 🫠
Chriis
ChriisOPβ€’14mo ago
No problem, thanks for steering me in the right direction πŸ™‚

Did you find this page helpful?