Change quick search filter behavior when using callbackColumn

Hi @johnny !

I would like to change the quick search behavior of a column when I use callbackColumn() to change the way I display data in the grid.
For example, if the original values in a column are comma separated ids I can use a callbackColumn() to retrieve their names (instead of showing the ids). In this case the quick search won’t work as expected (by the user), I mean, the user will not be able to search by name (only by ids like: “53, 61”, “76”).

Could you please show me a way to use the results from callbackColumn() in the quick search filter instead of original database values (ids in my case).

Thx.

PS.: can’t change db schema to use a n-to-n relation.

Hello @bgeneto ,

Not sure if this fits your needs but what if you use fieldTypeSearchColumn to change the search into a dropdown with your own model?

For example:

$crud->fieldTypeSearchColumn('contact_title', 'dropdown_search', [
    '12' => 'Master',
    '13' => 'Mr',
    '14' => 'Miss',
    '15' => 'Mrs',
    '16' => 'Missus',
    '17' => 'Ms',
    '18' => 'Mx'
]);

For more you can also check the official documentation here: fieldTypeSearchColumn - Grocery CRUD - A PHP CRUD Generator Library

1 Like

Thank you so much! I knew the child’s father would have a practical solution to this problem :slight_smile: