Can I use Form layouts like FieldSet with table filter ?

Can I use Form layouts like FieldSet with table filter ?
12 Replies
Dennis Koch
Dennis Koch15mo ago
Can you elaborate? Inside a filter? Should be possible. Any issues?
Ayman Alhattami
Ayman Alhattami15mo ago
I need like this in filter
Dennis Koch
Dennis Koch15mo ago
Yeah. And where are you stuck? Anything not working?
Ayman Alhattami
Ayman Alhattami15mo ago
This picture is form not filter, I want to make the same layout in table filter I have a lot of field in filter and I want to organize them like in the picture
Dennis Koch
Dennis Koch15mo ago
Yes. And it should be possible. Did you try it? Check the docs on filter forms
Ayman Alhattami
Ayman Alhattami15mo ago
public static function table(Table $table): Table { return $table ->columns(Transaction::getTableColumns()) ->filters([ Fieldset::make('hi')->schema([ Filter::make('id')->translateLabel() ->form([ TextInput::make('id'), ])->query(function (Builder $query, array $data): Builder { if (optional($data)['id']) { return $query->where('id', $data['id']); } else { return $query; } }), ]), ]); } This is the filter I used in the resource
Ayman Alhattami
Ayman Alhattami15mo ago
I got this error when I use FieldSet within table filter
Ayman Alhattami
Ayman Alhattami15mo ago
I've checked the docs and I did not found anything talking about that
techenby
techenby15mo ago
Try putting the Fieldset inside the ->form([ Something like this maybe?
->filters([
Filter::make('id')->translateLabel()
->form([
Fieldset::make('hi')->schema([
TextInput::make('id'),
TextInput::make('id'),
TextInput::make('id'),
}),
])->query(function (Builder $query, array $data): Builder {
if (optional($data)['id']) {
return $query->where('id', $data['id']);
} else {
return $query;
}
}),
]);
->filters([
Filter::make('id')->translateLabel()
->form([
Fieldset::make('hi')->schema([
TextInput::make('id'),
TextInput::make('id'),
TextInput::make('id'),
}),
])->query(function (Builder $query, array $data): Builder {
if (optional($data)['id']) {
return $query->where('id', $data['id']);
} else {
return $query;
}
}),
]);
Ayman Alhattami
Ayman Alhattami15mo ago
Ok, I will try
Dennis Koch
Dennis Koch15mo ago
Not sure how do didn’t find this. I even gave you the exact keywords. https://filamentphp.com/docs/2.x/tables/filters#filter-forms
Filament
Filters - Table Builder - Filament
The elegant TALL stack table builder for Laravel artisans.
Dennis Koch
Dennis Koch15mo ago
Also please read the #✅┊rules especially the part about code formatting
Want results from more Discord servers?
Add your server
More Posts