Update docs

This commit is contained in:
Zep Fietje
2023-02-14 11:29:02 +01:00
parent 681081e3f0
commit 4c7bdeb3b9
+22 -4
View File
@@ -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;