data-table-bundle icon indicating copy to clipboard operation
data-table-bundle copied to clipboard

Column filters

Open alexandre-castelain opened this issue 5 months ago • 1 comments

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 (via addFilter()) and a column filter (via the column's filter option) at the same time.
Attempting to add both types of filters for the same field will result in an InvalidArgumentException.

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.

alexandre-castelain avatar Aug 21 '25 08:08 alexandre-castelain

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 !

alexandre-castelain avatar Sep 29 '25 09:09 alexandre-castelain