© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago
howdu

Toggle selected table row

Can I use
getTableRecordAction
getTableRecordAction
to toggle the selected row?
E.g on click of the row if check/unchecks the selection checkbox.

Only way I've found to do this is by adding this to every column
->extraCellAttributes(fn ($record) => ['x-on:click' => "areRecordsSelected([{$record->id}]) ? deselectRecords([{$record->id}]) : selectRecords([{$record->id}])"])
->extraCellAttributes(fn ($record) => ['x-on:click' => "areRecordsSelected([{$record->id}]) ? deselectRecords([{$record->id}]) : selectRecords([{$record->id}])"])


Ideally, I'd like to do it like this:
protected function getTableRecordActionUsing(): ?\Closure
{
    return fn ($recordKey): string => "areRecordsSelected([{$recordKey}]) ? deselectRecords([{$recordKey}]) : selectRecords([{$recordKey}])";
}
protected function getTableRecordActionUsing(): ?\Closure
{
    return fn ($recordKey): string => "areRecordsSelected([{$recordKey}]) ? deselectRecords([{$recordKey}]) : selectRecords([{$recordKey}])";
}
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Uncheck/Un-toggle other rows when checkbox is selected
FilamentFFilament / ❓┊help
3y ago
Callback or Event on BulkAction table row selected one checkbox.
FilamentFFilament / ❓┊help
11mo ago
halt table toggle column
FilamentFFilament / ❓┊help
3y ago
Table row colorization
FilamentFFilament / ❓┊help
2y ago