I have a column that has, for example, values such as “SE”, “SE Technology”, “SE L” and I want to filter down to rows that contain just “SE”. But I get all the above if I filter on “SE” as it is a substring. What syntax do I need to enter to get just “SE” rows? I tried to find some “filter user guide”.
Thanks
A couple of options.
The default criteria cn (contains). You could modify the default search to be eq (equal), or use the magnifying glass which gives you the option to choose the criteria (contains, equals, does-not equal) in the advanced search.
Each column can have a default setting if you want to configure the search-options. See example below from another post by Abu:
The Demos have some very good examples of more advanced searching with forms as well.
Thanks
Mike
————–8< ————-
(e.g. bw = begins with, ‘eq’,’ne’,’lt’,’le’,’gt’,’ge’,’bw’,’bn’,’in’,’ni’,’ew’,’en’,’cn’,’nc’)
$col[“searchoptions”][“sopt”] = array(“cn”,”bw”); // only show contains and beginswith with first as default.
$cols[] = $col;
To limit search with exact match, you can set:
$col["searchoptions"]["sopt"] = array("eq");
Another way is to use dropdown filter.
https://www.gridphp.com/demo/demos/search/filter-row.php
https://www.gridphp.com/demo/demos/search/filter-row.phps line 64-70
You can also set hardcoded values in search dropdown if don’t want it from db.
https://www.gridphp.com/docs/column-options/#render-as-select-dropdown
e.g.
$col["searchoptions"] = array("value" => '10:$10;20:$20;30:$30;40:$40;50:$50');
Docs ref: https://www.gridphp.com/docs/column-options/#dropdown-in-filter-row
PS: Thanks Mike.