Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Search in the middle of a column by default in jqGrid with toolbar search

After reading the jqGrid wiki (and taking example from: Case insensitive search in jqGrid including hidden fields), I cannot find what I want to do.

Is there any search option to enable a search anywhere in a column (automatically wildcarded).

If the column contains "Apple Iphone" I would be able to find it by using the search "iphone".

The SQL equivalent would be select * from table where lower(columnX) like '%iphone%';

like image 418
рüффп Avatar asked Nov 30 '22 08:11

рüффп


1 Answers

Since you use toolbar searching the solution of your problem seems to be simple. You should:

  1. include ignoreCase:true to the jqGrid parameters
  2. include defaultSearch:'cn' option to the call of filterToolbar. For example: $("#list").jqGrid('filterToolbar', {defaultSearch:'cn'}).
  3. If you use any select elements in the searching toolbar (stype:'select') you should include in the list of searchoptions the sopt options which begin with 'eq': stype:'select', searchoptions: {sopt:['eq','ne']} for example.
like image 107
Oleg Avatar answered Dec 06 '22 08:12

Oleg