F
Filamentβ€’6mo 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
dyoβ€’6mo ago
i cant use it in filament v2
DrByte
DrByteβ€’6mo ago
Oh. Sorry. I missed that. I don't know much about v2 ! 😭
dyo
dyoβ€’6mo ago
thanks for your answer though anyone can help me? i still not figure this out.. i still need help..
Vp
Vpβ€’6mo 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
Vpβ€’6mo ago
No description
dyo
dyoβ€’6mo 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
Vpβ€’6mo 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
Vpβ€’6mo ago
Result
No description
dyo
dyoβ€’6mo ago
this method works fine for me.. thanks..