data-table-bundle
data-table-bundle copied to clipboard
Column filters
Description
This merge request adds support for column filters, as explained in #85
$builder
->addColumn('name', TextColumnType::class, [
'label' => 'Full name',
'sort' => true,
'filter' => StringFilterType::class,
]);
You can pass options to the filter using the filter_options array:
$builder
->addColumn('name', TextColumnType::class, [
'label' => 'Full name',
'sort' => true,
'filter' => StringFilterType::class,
'filter_options' => [
'operator_selectable' => true,
],
]);
Note:
A field cannot have both a header filter (viaaddFilter()) and a column filter (via the column'sfilteroption) at the same time.
Attempting to add both types of filters for the same field will result in anInvalidArgumentException.
Points to check
- Verify if using a boolean to distinguish filter types is sufficient, or if we should switch to an enumeration.
- I have not tested all filter options, but the ones I tried seem to work correctly.
- Only the base.html.twig file was modified. Maybe we should improve the other template, but I'm not sure it's necessary. As you wish.
Hi @Kreyu ! :) Any news about those MR ? I know it takes a lot of time to review, but I just want to check if it will be possible to be merged one day or not at all because it's not on your roadmap ? Thanks, Have a good day !