Individual column search in table with Symfony and Omines bundle

  datatables, symfony, symfony4

There is a question about searching by columns in a table. I use Symfony 4 and Omines bundle.

I want to do a individual column search, but it doesn’t work. More precisely, it works on the full occurrence of the string. For example, there is a value Donald Trump and a search for "donald trump" will find it. But I would like the search to work on substring as well: ex. "nald".

In this case, the request in the url is formed, but on the server side it does not find matches by the substring. Global search (for the whole table, it add in DOM) works fine. Searches both by full match and by substring.

Do I need to do server side request processing? Or is there a ready-made column search solution in Omines?


public function list(Request $request, DataTableFactory $dataTableFactory)
        $table = $dataTableFactory->create()
            ->add('firstName', TextColumn::class, ['label' => 'Имя', 'field' => 'c.firstName', 'searchable' => true])
            ->add('phone', TextColumn::class, ['label' => 'Телефон', 'field' => '', 'searchable' => true])
            ->add('email', TextColumn::class, ['label' => 'E-mail', 'field' => '', 'searchable' => true])
            ->add('total', NumberColumn::class, ['label' => 'Сумма заказов', 'field' => 'total.ordersTotal', 'searchable' => false])
            ->add('accessCount', NumberColumn::class, ['label' => 'Кол-во визитов', 'field' => 'c.accessCount', 'searchable' => true])
            ->add('firstAccess', DateTimeColumn::class, ['label' => 'Первый визит', 'format' => 'd-m-Y h:i', 'field' => 'c.firstAccess', 'searchable' => true])
            ->add('lastAccess', DateTimeColumn::class, ['label' => 'Последний визит', 'format' => 'd-m-Y h:i', 'field' => 'c.lastAccess', 'searchable' => true])
            ->createAdapter(ORMAdapter::class, [
                'hydrate' => Query::HYDRATE_ARRAY,
                'entity' => Customer::class,
                'query' => function (QueryBuilder $builder) {
                        ->select('c.firstName,,, c.accessCount, c.firstAccess, c.lastAccess, SUM( AS ordersTotal')
                        ->from(Customer::class, 'c')
                        ->join('c.orders', 'o')

        if ($table->isCallback()) {
            return $table->getResponse();

        return $this->render('admin/customer/index.html.twig', [
            'customers' => $table,


        $(function () {
            $('#customersTable').initDataTables({{ datatable_settings(customers) }}, {
                searching: true,

                initComplete: function () {
                    this.api().columns().every(function () {
                        let that = this;

                        $('input', this.footer()).on('keyup change clear', function () {
                            if ( !== this.value) {

                        $('option.toggle-vis').on('click', function (e) {
                            let column = that.column($(this).attr('data-column'));


                    let r = $('tfoot tr');
                    r.find('th').each(function () {
                        $(this).css('padding', 8);
                    $('#search_0').css('text-align', 'center');

            }).then(function (dt) {

                $('tfoot th').each(function () {
                    let title = $(this).text();
                    $(this).html('<input type="search" class="form-control form-control-sm" placeholder="Поиск по полю ' + title + '" />');



Global search

Individual column search

Individual column search with full value

I would be grateful for your help!

Source: Symfony Questions