filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
17.65k stars 2.76k forks source link

[2.x] Column url by default redirects to resource record edit #845

Closed Majkie closed 2 years ago

Majkie commented 2 years ago

Package

filament/tables

Package Version

v2.5.20

Laravel Version

v8.75.0

Livewire Version

v2.8.2

PHP Version

PHP 8.1

Bug description

In cell.blade.php else if on $url is always true, because CanOpenUrl trait returns either defined url or record url so all columns are by default currently clickable with redirect to resource edit.

return $this->url ?? $this->getTable()->getRecordUrl($record);

For now it can be resolved like this. Although it would be better to fix this so others don't have to look for solution. Sadly I don't have time to make this simple PR, so thanks for resolving this.

Tables\Columns\TextColumn::make('name')->url(fn() => null'),

Steps to reproduce

Create simple TextColumn.

Tables\Columns\TextColumn::make('name'),

Relevant log output

No response

danharrin commented 2 years ago

Hi, this is actually intended behaviour, a UX thing. It just allows people to access the records easier if they don't want to move their mouse to the Edit button. You can disable this behaviour for the entire table by using this code on the List page:

protected function getTableRecordUrlUsing(): ?Closure
{
    return null;
}