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_TopicIcon
Call Grid search with user values
22/04/2013
14:19
Avatar
pankajpandey
Member
Members
Forum Posts: 7
Member Since:
28/01/2013
sp_UserOfflineSmall Offline

Hi,

I have a grid with some data in it. Based on certain values selected by User in other form, I have to call the multi Search of jqGrid. I have the column name/value pairs on which the search should be performed, but couldn't find a way to call the search on the grid with these arguments, similar to the way we do multi search from the Search toolbar.

Anyone has any suggestions?

Thanks!

Regards,

Pankaj

22/04/2013
15:30
Avatar
pankajpandey
Member
Members
Forum Posts: 7
Member Since:
28/01/2013
sp_UserOfflineSmall Offline

Got below code from google. Can someone suggest how to use this with local data. I am loading the grid with loadonce=true and don't want to send the request back to the server.

$("#search").click(function() { var searchFiler = $("#filter").val(), grid = $("#list"), f; if (searchFiler.length === 0) { grid[0].p.search = false; $.extend(grid[0].p.postData,{filters:""}); } f = {groupOp:"OR",rules:[]}; f.rules.push({field:"name",op:"cn",data:searchFiler}); f.rules.push({field:"note",op:"cn",data:searchFiler}); grid[0].p.search = true; $.extend(grid[0].p.postData,{filters:JSON.stringify(f)}); grid.trigger("reloadGrid",[{page:1,current:true}]); });

22/04/2013
15:34
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hello!

I posted many variation on the stackoverflow.com what can be done to do what you need. Look at the answer or this one for example.

Best regards
Oleg 

23/04/2013
09:22
Avatar
pankajpandey
Member
Members
Forum Posts: 7
Member Since:
28/01/2013
sp_UserOfflineSmall Offline

Awesome, worked like a charm Laugh.

Thanks Oleg!

Regards,

Pankaj

17/05/2013
10:20
Avatar
jags
Member
Members
Forum Posts: 3
Member Since:
17/05/2013
sp_UserOfflineSmall Offline

Where can I find some documentation about the filters option in postData? Is it possible to pass multiple values in data -property? For example:

f.rules.push({field:"id",op:"eq",data:[id1,id2]});

At least it didn´t work for me....
17/05/2013
10:28
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

here is described format of postData.

With

f.rules.push({field:"id",op:"eq",data:[id1,id2]});

you mean probably something like id=123 OR id=345.

You should just use groupOp: "OR" like I described in previously referenced answers.

17/05/2013
12:28
Avatar
jags
Member
Members
Forum Posts: 3
Member Since:
17/05/2013
sp_UserOfflineSmall Offline

Hmm…Is that link you gave working? It shows this same topic or do I miss something. But what I´m trying to achieve is, that for example I have 2 grid columns and I want to filter them like this based on user selections:

(id=1 OR id = 2) AND col2 = 456

So for example the code could be if possible:

f = {groupOp:"AND",rules:[]};
f.rules.push({field:"id",op:"eq",data:[1,2]});
f.rules.push({field:"col2",op:"eq",data:456});
17/05/2013
12:53
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Sorry, the correct link to the docomentation is here. If you need implement (id=1 OR id = 2) AND col2 = 456 then you should create subgroup with groupOp:"OR" and use groupOp:"AND" on the top level. See the answer for the code example.

17/05/2013
13:25
Avatar
jags
Member
Members
Forum Posts: 3
Member Since:
17/05/2013
sp_UserOfflineSmall Offline

Yep, that worked perfectly. Thank you very much for all your help Oleg!

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
22 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