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
Save Search Parameters
13/08/2009
06:27
Avatar
avagarwal
Member
Members
Forum Posts: 22
Member Since:
30/11/2008
sp_UserOfflineSmall Offline

Hi,

Is it possible to save the search parameters in  session or a cookie, so that next time the user comes back to the page the grid can be setup to display the previous results and also the search parameters are populated. We can keep track of the search parameters and use them to display the same data, but how can we populate them into the grid?

Thanks

Anurag

13/08/2009
07:42
Avatar
glemarie
France
Member
Members
Forum Posts: 66
Member Since:
19/12/2008
sp_UserOfflineSmall Offline

This is what I do :

(seach parameters input id's always stats with "gs_")

Save search parameters ("memoriseFiltre" is a function that saves a cookie)

var initialLoad = true;
jQuery("#mygrid").jqGrid({

...

loadComplete: function() {
                    // Save filters, but not when displaying the page for the first time
                        if (!initialLoad) {
                        $(document).find("[id^='gs_']").each( function() {
                            memoriseFiltre($(this).attr('id'), $(this).val());
                        });
                    initialLoad = false;
                }

});

Get back search parameters ("recupereFiltre" is a function that gets a cookie value)

// After creating the grid

var filterValue;

$(document).find("[id^='gs_']").each( function() {

             filterValue= recupereFiltre($(this).attr('id'));
             $(this).val(filterValue);
});

13/08/2009
21:33
Avatar
avagarwal
Member
Members
Forum Posts: 22
Member Since:
30/11/2008
sp_UserOfflineSmall Offline

Hi,

I would like to try and avoid using cookies and store the information in a session, is there any method to return back the search parameters as part of the JSON data string and populate it in load complete?

Thanks

Anurag

14/08/2009
03:12
Avatar
glemarie
France
Member
Members
Forum Posts: 66
Member Since:
19/12/2008
sp_UserOfflineSmall Offline

In 3.5, there is a new functionnality : summary footer row that uses a second array (userdata) in the json result. Maybe you could use something like this to store your search parameters ?

I don't know if you can access to the json array in the client side script, but maybe Tony could tell us…

15/08/2009
02:33
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

You can use postData array for this purpose.

Store the the search parameters and then:

var stored_param = {}

stored_param = here your code to get these

...jqGrid({

...

postData: stored_param,

...

});

Do not forgaet maybe to add search:true in these parameters

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

20/08/2009
21:28
Avatar
avagarwal
Member
Members
Forum Posts: 22
Member Since:
30/11/2008
sp_UserOfflineSmall Offline

Hi,

From my page I am passing back the search data parameters that were stored in the session in userdata as follows -

userdata { searchdata: [{field:firstname, op:bw, value:A}, {.....}] }

and can access the same in the gridComplete event.

How can I set these values back into the search form (multisearch:true), so that when the user presses the search button, the search parameters are already selected for him?

Thanks

Anurag

21/08/2009
03:58
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Right now I understand what you mean. Sorry currently not possible.

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

21/08/2009
11:07
Avatar
avagarwal
Member
Members
Forum Posts: 22
Member Since:
30/11/2008
sp_UserOfflineSmall Offline

Hi Tony,

If we dig into the code, do you think this can be done?

Thanks

Anurag

22/08/2009
02:40
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Everything is possible Wink

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

12/09/2009
12:34
Avatar
gstoynev
New Member
Members
Forum Posts: 1
Member Since:
12/09/2009
sp_UserOfflineSmall Offline

I also need this.,

Any suggestions as to where to "touch" to implement this?

Could you scatch the solution - willing to impleent.

13/09/2009
05:08
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Actually you can look at jquery.searchFilter.js.

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

14/09/2009
00:17
Avatar
avagarwal
Member
Members
Forum Posts: 22
Member Since:
30/11/2008
sp_UserOfflineSmall Offline

Hi,

The way we are implementing this is to save the search parameters in session when ever a search is conducted. Then when the user returns to this page, we use the session value to filter the data and also return the values as user data in the json string. The grid complete function is utilized to set these values as search critera.

Thanks

Anurag

16/09/2009
22:45
Avatar
gstoynev
Guest
Guests

avagarwal said:

...

The grid complete function is utilized to set these values as search critera.

...


Are you talking about the advanced search? could you post your relevant comlete code.

Thanks

16/09/2009
22:52
Avatar
gstoynev
Guest
Guests

...

Actually you can look at jquery.searchFilter.js.

Regards

Tony


Thank you

18/04/2011
11:21
Avatar
donato.gr
Italy
Member
Members
Forum Posts: 4
Member Since:
18/04/2011
sp_UserOfflineSmall Offline

I have this problem too (prefill filter form on page load). Have you found any solution?

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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