© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•17mo ago•
9 replies
w5m

How to get all options from table filter in table header action?

I've created a custom filter form for a table on a relation page (i.e. a class which extends
ManageRelatedRecords
ManageRelatedRecords
). I have a
Select
Select
component as part of the filter form and this is populated with a list of projects.

Within a table header action, I'd like to retrieve the list of projects (i.e.
Select
Select
options), in order to provide navigation to one of the projects in the list. Unfortunately, I'm struggling to access the
Select
Select
component, so would be grateful to be pointed in the right direction.

public function table(Table $table): Table
{
  return $table
    ->columns([ 
      // ...
    ])
    ->filters([
      Filter::make('client_project')
        ->form([
          Select::make('client_id'),
          Select::make('project_id')
        ])
        ->query(function (Builder $query, array $data) {
          // ...
        }),
    ])
    ->headerActions([
      Tables\Actions\Action::make('next-project')
        ->url(function (\Livewire\Component $livewire): string {
          $filters = $livewire->getTable()->getFilters();
          dd($filters['client_project']);
          // how do I retrieve all of the options listed in the 'project_id' Select component?
        })
    ]);
}
public function table(Table $table): Table
{
  return $table
    ->columns([ 
      // ...
    ])
    ->filters([
      Filter::make('client_project')
        ->form([
          Select::make('client_id'),
          Select::make('project_id')
        ])
        ->query(function (Builder $query, array $data) {
          // ...
        }),
    ])
    ->headerActions([
      Tables\Actions\Action::make('next-project')
        ->url(function (\Livewire\Component $livewire): string {
          $filters = $livewire->getTable()->getFilters();
          dd($filters['client_project']);
          // how do I retrieve all of the options listed in the 'project_id' Select component?
        })
    ]);
}
Solution
I've finally managed to get hold of the list of Select options. I had to modify the creation of the
project_id
project_id
Select component slightly by adding
->key('project')
->key('project')
. Then, in the header action, the following code gave me an array of the options...
Tables\Actions\Action::make('next-project')
  ->action(function (\Livewire\Component $livewire): string {  
    $filters = $livewire->getTable()->getFilters();
    $filter = $filters['client_project'];
    dd($filter->getForm()->getComponent('project')->getOptions());
  })
Tables\Actions\Action::make('next-project')
  ->action(function (\Livewire\Component $livewire): string {  
    $filters = $livewire->getTable()->getFilters();
    $filter = $filters['client_project'];
    dd($filter->getForm()->getComponent('project')->getOptions());
  })
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

How to get all table records in header action
FilamentFFilament / ❓┊help
2y ago
How to get selected record from table in header action?
FilamentFFilament / ❓┊help
3y ago
Get table data from header action.
FilamentFFilament / ❓┊help
3y ago
Add table filter to header actions
FilamentFFilament / ❓┊help
2mo ago