FilamentF
Filament5mo ago
Asmit

Help: Filter Reset Action

I’m building a custom Filament page where I’m not using a table, but I added a FilterAction to handle filtering. It’s working, but I’m struggling to add a reset button to clear the filters from the modal form.
public function filterAction()
    {
        return FilterAction::make('filter')
            ->slideOver(false)
            ->form([
                TextInput::make('title')
                    ->live()
                    ->label('Search'),
                Select::make('status')
                    ->label('Status')
                    ->options(DocumentStatus::class)
                    ->placeholder('All Statuses')
                    ->searchable()
                    ->preload(),
            ]);
    }


In my Blade view, I render it like:
{{ $this->filterAction }}

How can I add a reset/clear action to this filter modal?
Any help would be appreciated!
Solution
Suer, @Dennis Koch ,

For now,
 ->extraModalFooterActions(function () {
                return [
                    Action::make('reset')
                        ->label('Reset')
                        ->color('secondary')
                        ->icon('heroicon-o-x-circle')
                        ->action(function () {
                          // reset data.
                            $this->reset('property');
                            $this->replaceMountedAction('cancel');
                        }),
                ];
            })

this solution work for me
Was this page helpful?