F
Filament7mo 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_7mo ago
You can use recordUrl with record is trashed then return null
Chriis
Chriis7mo 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
Chriis7mo ago
With the method getUrl() of the resource its working. Thanks
einnlleinhatt_
einnlleinhatt_7mo ago
Sorry just got back.
->recordUrl(function ($record) {
if ($record->trashed()) {
return null;
}
->recordUrl(function ($record) {
if ($record->trashed()) {
return null;
}
Chriis
Chriis7mo 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 Koch7mo ago
Makes sense because this code either retuns null or void
Chriis
Chriis7mo 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_7mo ago
Oh yeah missed the return view, apologize 🫠
Chriis
Chriis7mo ago
No problem, thanks for steering me in the right direction 🙂