F
Filament2y ago
dyo

Set filter form column in relation manager

Can anyone tell me what should i do to set filter form column in relation manager? I want to have 3 grid of columns at filter forms, using filament v2..
Solution:
Ok, then do like this ```php return $table ... ->filters([...
Jump to solution
11 Replies
dyo
dyoOP2y ago
i cant use it in filament v2
DrByte
DrByte2y ago
Oh. Sorry. I missed that. I don't know much about v2 ! 😭
dyo
dyoOP17mo ago
thanks for your answer though anyone can help me? i still not figure this out.. i still need help..
Vp
Vp17mo ago
Hi, I am not sure in which place you stuck but you can use below method
return $table
...
->filters([
Filter::make('created_at')
->form([
Forms\Components\DatePicker::make('created_from'),
Forms\Components\DatePicker::make('created_until'),
]),
])
...
return $table
...
->filters([
Filter::make('created_at')
->form([
Forms\Components\DatePicker::make('created_from'),
Forms\Components\DatePicker::make('created_until'),
]),
])
...
put this inside relation manager table, and you'll get the below response.. you modify the form base on your requirement
Vp
Vp17mo ago
No description
dyo
dyoOP17mo ago
thanks for your response.. as i mention in the beginning, i want to have 3 grid of columns at filter forms, using filament v2..
Solution
Vp
Vp17mo ago
Ok, then do like this
return $table
...
->filters([
Filter::make('created_at')
->form([
Grid::make(3)
->schema([
Forms\Components\DatePicker::make('created_from'),
Forms\Components\DatePicker::make('created_until'),
Forms\Components\DatePicker::make('updated_at'),
]),
])
->columnSpan('full'),
])
...

// use filter layout like below
protected function getTableFiltersLayout(): ?string
{
return Layout::AboveContent;
}
return $table
...
->filters([
Filter::make('created_at')
->form([
Grid::make(3)
->schema([
Forms\Components\DatePicker::make('created_from'),
Forms\Components\DatePicker::make('created_until'),
Forms\Components\DatePicker::make('updated_at'),
]),
])
->columnSpan('full'),
])
...

// use filter layout like below
protected function getTableFiltersLayout(): ?string
{
return Layout::AboveContent;
}
Ref: https://filamentphp.com/docs/2.x/tables/filters#displaying-filters-above-or-below-the-table-content
Vp
Vp17mo ago
Result
No description
dyo
dyoOP17mo ago
this method works fine for me.. thanks..

Did you find this page helpful?