mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-19 10:12:36 +08:00
Update docs
This commit is contained in:
@@ -290,7 +290,9 @@ protected function applySearchToTableQuery(Builder $query): Builder
|
||||
|
||||
Scout uses this `whereIn()` method to retrieve results internally, so there is no performance penalty for using it.
|
||||
|
||||
## Record URLs (clickable rows)
|
||||
## Clickable rows
|
||||
|
||||
### Record URLs
|
||||
|
||||
You may allow table rows to be completely clickable by overriding the `getTableRecordUrlUsing()` method on your Livewire component:
|
||||
|
||||
@@ -298,7 +300,7 @@ You may allow table rows to be completely clickable by overriding the `getTableR
|
||||
use Closure;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
protected function getTableRecordUrlUsing(): Closure
|
||||
protected function getTableRecordUrlUsing(): ?Closure
|
||||
{
|
||||
return fn (Model $record): string => route('posts.edit', ['record' => $record]);
|
||||
}
|
||||
@@ -308,9 +310,25 @@ In this example, clicking on each post will take you to the `posts.edit` route.
|
||||
|
||||
If you'd like to [override the URL](columns/getting-started#opening-urls) for a specific column, or instead [run a Livewire action](columns#running-actions) when a column is clicked, see the [columns documentation](columns#opening-urls).
|
||||
|
||||
## Disable clickable rows
|
||||
### Record actions
|
||||
|
||||
If you'd like to completely disable the click action for the entire row, you can override the `getTableRecordActionUsing()` method on your Livewire component, and return `null`:
|
||||
Alternatively, you may configure table rows to trigger an action instead of opening a URL:
|
||||
|
||||
```php
|
||||
use Closure;
|
||||
use Filament\Tables\Actions\Action;
|
||||
use Filament\Tables\Actions\DeleteAction;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
protected function getTableRecordActionUsing(): ?Closure
|
||||
{
|
||||
return fn (): Action => DeleteAction::make();
|
||||
}
|
||||
```
|
||||
|
||||
### Disabling clickable rows
|
||||
|
||||
If you'd like to completely disable the click action for the entire row, you may override the `getTableRecordActionUsing()` method on your Livewire component, and return `null`:
|
||||
|
||||
```php
|
||||
use Closure;
|
||||
|
||||
Reference in New Issue
Block a user