Forum
08:36
15/01/2014
Using the toolbar search feature provided by jqgrid in my application. The search logic is handled at the server-side. It works perfect. I am trying to integrate the operand based search on toolbar. The problem is it doesn't send any operand based information to the backend, thus making it impossible for me do proper search.
I have initialized my JQGRID something like this:
$("#list").jqGrid({
url:'rest/usertest/users',
datatype: "json",
mtype: "POST",
colNames: ["Username", "Name", "Grouping"],
colModel: [
{ name: "username" ,sorttype:'string',searchoptions:{sopt:['eq','bw','bn','cn','nc','ew','en']}},
{ name: "name", width: 90 ,sorttype:'string',searchoptions:{sopt:['eq','bw','bn','cn','nc','ew','en']}},
{ name: "grouping", width: 80, sorttype:'string',searchoptions:{sopt:['eq','bw','bn','cn','nc','ew','en']}},
],
pager: "#pager",
autowidth: true,
multiselect: false,
viewrecords: true,
sortorder: "asc",
sortname: "username",
rowList: [10, 20, 30],
rowNum: 10,
multiSort: true,
gridview: true,
height: 'auto',
autowidth: true,
});
jQuery("#list").jqGrid('filterToolbar',{searchOnEnter : true,searchOperators : true, search:true});
While searching, the request does not contain any operator based information. Am I missing any configuration option. Please advice.
20:57
22/05/2013
In the request sent to the server, the filter is going to have three parts
{"groupOp":"AND","rules":[{"field":"SUMMARY","op":"eq","data":"test"}]}
field = column index we are searching on
op = operator
data = value in the box that we are filtering on
i ran a couple of tests using a text filter in my filtertoolbar and it seems to be working. whatever the FIRST value in your "sopt" array in colmodel is, it will be sent as the "op" in the filter in the ajax request.
edit: i just noticed you have "searchOperators=true" for filtertoolbar, so this means that which ever operator is selected by teh user will be sent as the "op" in the filter
Use debugger tools like Chrome console or firebug to look at the request sent to the server and take a look at what is sent as the filters parameter
Most Users Ever Online: 715
Currently Online:
30 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66