post by bgeneto on Jan 9, 2024

I’ve noticed that quick filtering INT (or BIGINT) columns behaves differently than quick filtering CHAR (or VARCHAR) and other types (like FLOAT).

It seems to me that GCE uses WHERE col LIKE '%val%' for filtering CHAR, VARCHAR, FLOAT and other types and WHERE col = val for INT/BIGINT, DECIMAL and possibly other types.

Wouldn’t it be a good idea to maintain uniformity across all quick search filtering, regardless of the type of the field/column? I don’t know if every DBMS supports using the LIKE operator for every data type, but I think mysql/mariadb does…

I understand that for many things using the ‘equal’ operator with INT fields makes more sense. The problem is that many of us is using BIGINT for codes or small UUIDs and filtering using ‘like’ operator makes more sense.

I also understand that we can have many filtering options/operators in the filter modal window. But is it possible to customize the behaviour of the quick filtering per column/field?

Thanks in advance!

post by johnny on Jan 9, 2024

Hello @bgeneto ,

When we are dealing with numbers it is more rare to search by LIKE. In case you would like to do so you can simply change the field type only for the datagrid to treat it as a string. For example:

$crud->fieldTypeColumn('your_field_name', 'string');

post by bgeneto on Jan 10, 2024

Thanks Johnny, but fieldTypeColumn method didn’t work for me, but the fieldType did the (quick filter) trick I need.

$crud->fieldType('your_field_name', 'string');

post by johnny on Jan 10, 2024

1 / 4
Jan 2024