Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
Toolbar search: how to send search operator information to server side
15/01/2014
08:36
Avatar
generic.bloodsucker
New Member
Members
Forum Posts: 1
Member Since:
15/01/2014
sp_UserOfflineSmall Offline

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.

24/01/2014
20:57
Avatar
Lonewolf217
Member
Members
Forum Posts: 32
Member Since:
22/05/2013
sp_UserOfflineSmall Offline

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

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information