Use FilterAction in a custom widget

Hi, I am trying to use FilterAction in a custom widget. It appears beside other action button but does not open the filter drop-down. Is it possible to use FilterAction just like other actions? Am i missing something?
class CustomStatWidget extends Widget implements HasActions, HasForms
{
use HasFiltersAction;
use HasFiltersForm;
use InteractsWithActions;
use InteractsWithForms;
use InteractsWithPageFilters;

public function applyFiltersAction(): FilterAction
{
return FilterAction::make()
->label('')
->icon('heroicon-o-funnel')
->color('gray')
->iconButton()
->form([
DatePicker::make('startDate'),
DatePicker::make('endDate'),
// ...
])
->action(function () {

});
}
}
class CustomStatWidget extends Widget implements HasActions, HasForms
{
use HasFiltersAction;
use HasFiltersForm;
use InteractsWithActions;
use InteractsWithForms;
use InteractsWithPageFilters;

public function applyFiltersAction(): FilterAction
{
return FilterAction::make()
->label('')
->icon('heroicon-o-funnel')
->color('gray')
->iconButton()
->form([
DatePicker::make('startDate'),
DatePicker::make('endDate'),
// ...
])
->action(function () {

});
}
}
<div class="flex items-center gap-2">
{{ $this->createResourceAction }}
{{ $this->viewResourceAction }}
{{ $this->applyFiltersAction }}
</div>
<div class="flex items-center gap-2">
{{ $this->createResourceAction }}
{{ $this->viewResourceAction }}
{{ $this->applyFiltersAction }}
</div>
1 Reply
Mansoor Khan
Mansoor KhanOP8mo ago
Seems like FilterAction can only be use inside page header actions using getHeaderActions Is there any way to use them anywhere? I replaced the FilterAction with normal action Filament\Actions\Action the trigger button renders but it does not open modal. strange.
Want results from more Discord servers?
Add your server