Filtering by clicking on column
I'm trying to set a table filter by clicking on the corresponding value in a table column using
action()
(as extraAttributes()
gets escaped by blade).
Using the following code
has no effect.
The column (including the description, unfortunately) is clickable, and a request gets sent, but nothing else happens. Am I missing something? Do I have to tell the component to re-render?
Setting a filter in html using wire:click="$set('tableFilters.filterName', [ '{{ $value }}' ])"
does work fine, but is not achievable currently without overwriting the column templates and adding custom code.2 Replies
maybe wrap the attribute value in
new HtmlString()
if you want to use extraattributes
with action()
, does a dd()
run?
try ->action(fn ($record) => Action::make('filterColumnName')->action(fn () => $this->tableFilters['filterName'] = $record->value))
No effect as well, and dd() is the same. If I find the time I'll investigate further.
does work though, thanks for the suggestion.