omines / datatables-bundle

DataTables bundle for Symfony
https://omines.github.io/datatables-bundle/
MIT License
260 stars 114 forks source link

ArrayAdapter `searchable` and `globalSearchable` don't work #340

Closed ToshY closed 4 months ago

ToshY commented 5 months ago

Problem

Using ArrayAdapter with the options searchable => false or globalSearchable => false on any type of column does not do anything. It still returns all the results.

Reproduction

Example from docs, including searchable and globalSearchable options

        $dataTable = $dataTableFactory->create()
            ->add('firstName', TextColumn::class, ['searchable' => false, 'globalSearchable' => false])
            ->add('lastName', TextColumn::class)
            ->createAdapter(ArrayAdapter::class, [
                ['firstName' => 'Donald', 'lastName' => 'Trump'],
                ['firstName' => 'Barack', 'lastName' => 'Obama'],
            ])
            ->handleRequest($request);

        if ($dataTable->isCallback()) {
            return $dataTable->getResponse();
        }

Checking in UI and searching on donald gives back the result, even though it should not be searchable.

image

Version