I am working with Filament Table in a Laravel project. I want to hide the filters modal when the “Apply Filters” button is clicked. Here is the code I’m currently working with. How can I achieve this functionality?
public static function table(Table $table): Table
{
return $table->deferLoading()->recordUrl(null)->paginated([10, 25, 50, 75, 100])->striped()
->columns([
TextColumn::make('#')->rowIndex(),
TextColumn::make('name')->searchable()
->sortable(),
TextColumn::make('contact_number')->label('Contact Number')->searchable()
->sortable(),
TextColumn::make('email')->searchable()
->sortable(),
ImageColumn::make('company_logo')->height(50),
TextColumn::make('status')->badge()->searchable()
->color(fn (string $state): string => match ($state) {
Status::Active->value => Status::Active->getColor(),
Status::Deactive->value => Status::Deactive->getColor(),
default => 'gray',
})
->formatStateUsing(fn (string $state): string => match ($state) {
Status::Active->value => Status::Active->getLabel(),
Status::Deactive->value => Status::Deactive->getLabel(),
default => 'Unknown',
})
->icon(fn (string $state): ?string => match ($state) {
Status::Active->value => Status::Active->getIcon(),
Status::Deactive->value => Status::Deactive->getIcon(),
default => null,
})
->sortable()
->searchable(),
])
->defaultSort('id', 'desc')
->filters(static::getTableFilters())
->filtersTriggerAction(
fn (Action $action) => $action
->button()
->label('Filters')
)
->actions([
TablesActionsEditAction::make(),
])
->bulkActions([
TablesActionsBulkActionGroup::make([
TablesActionsDeleteBulkAction::make(),
]),
])->deferFilters();
}
You can see this image. I want to hide the filters modal when the Filters is applied
any one help me on this i am stuck on this.