Applying Filters using $table->headerActions()

Hi, I have a quick question: If I have a table with a filter like:
$table
(...)
->filters([
Tables\Filters\Filter::make('today')
->query(fn (Builder $query) => $query->whereDate('inbound_appointment', Carbon::today())),
])
$table
(...)
->filters([
Tables\Filters\Filter::make('today')
->query(fn (Builder $query) => $query->whereDate('inbound_appointment', Carbon::today())),
])
Is it possible to apply this filter from an outside action, like a headerAction in the same table, for example:
$table
->filters(...same as above...)
->headerActions([
Action::make('today')
->action(fn($table) => $table->getFilter('today') !!! some method here like "->apply()" !!!)
])
$table
->filters(...same as above...)
->headerActions([
Action::make('today')
->action(fn($table) => $table->getFilter('today') !!! some method here like "->apply()" !!!)
])
Basically, I want to be able to manipulate the table filters using methods on the table. Any ideas?
1 Reply
Victor Pennington
Victor PenningtonOP4mo ago
I know I can use queryStrings to achieve some similar effect, but it would be rather interesting to achieve this with different routes too
Want results from more Discord servers?
Add your server