Show table row action only when filter is enabled

Hey all, Is it possible to hide an action in the table when a filter is not enabled?
Solution:
Seems like it is tableFilters
Jump to solution
4 Replies
Dennis Koch
Dennis Koch7mo ago
You can access the filters via the Livewire component: ->visible(fn ($livewire) => $livewire->activeFilters
JJSanders
JJSandersOP7mo ago
Thanks for your reply. I have tried it. I am getting this error:
Property [$activeFilters] not found on component:
Property [$activeFilters] not found on component:
This is my code:
Tables\Actions\Action::make('approve')
->icon('heroicon-s-check')
->action(function (Product $record) {
$record->reviewed_at = now();
$record->needs_attention = false;
})
->visible(function ($livewire){
ray($livewire->activeFilters)->once();
}),
Tables\Actions\Action::make('approve')
->icon('heroicon-s-check')
->action(function (Product $record) {
$record->reviewed_at = now();
$record->needs_attention = false;
})
->visible(function ($livewire){
ray($livewire->activeFilters)->once();
}),
Solution
Dennis Koch
Dennis Koch7mo ago
Seems like it is tableFilters
JJSanders
JJSandersOP7mo ago
Yeah that's it
Want results from more Discord servers?
Add your server