Type to search columns, filters, options, and extensions.

↑↓ to navigate · Enter to open · Esc to close

Documentation

Filters

When and how to add declarative filters to a server-side DataTable

What / When

Filters add a popover next to the search box. Use them on Doctrine server-side tables when users need structured criteria (status, date range, free text) beyond global search.

They do not apply to client-side inline datasets in this version.

Minimal Example

Declare filters on your AbstractDataTable:

use Pentiminax\UX\DataTables\Filter\ChoiceFilter;
use Pentiminax\UX\DataTables\Filter\TextFilter;
use Pentiminax\UX\DataTables\Model\Filters;

public function configureFilters(Filters $filters): Filters
{
    return $filters
        ->add(TextFilter::new('email')->label('Email'))
        ->add(
            ChoiceFilter::new('status')
                ->label('Status')
                ->options(['Draft' => 'draft', 'Published' => 'published'])
        );
}

Or declare them on the class holding the data, with no configureFilters() at all:

use App\Enum\Status;
use Pentiminax\UX\DataTables\Attribute\DataTableFilter;

class User
{
    #[DataTableFilter(options: ['label' => 'Email'])]
    private string $email;

    #[DataTableFilter(options: ['label' => 'Status'])]
    private Status $status;
}

The filter class is guessed from the declared type, and a BackedEnum brings its own options along.

Pitfalls