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
Return to current position in grid
27/10/2009
07:02
Avatar
SimonL
Member
Members
Forum Posts: 39
Member Since:
23/07/2009
sp_UserOfflineSmall Offline

Hi,

Because of the stateless nature of the web, this is a classic problem and I wondered if anyone has a good (easy Smile) strategy that could help me. I've constructed my jquery grid and it works superbly (thank you Tony for your hard work on jqGrid). One of the columns in my grid has an edit button, which when the user clicks it, it takes the user to a different page where they can edit the selected record. There is of course a link on that page that allows the user back to the page with the grid (or simply pressing the back button). But of course the user is  presented with the grid at page one, and not necessarily on the page of the grid that contains the record they just chose to edit. Yes I realise the options are inline editing, or even form editing on the client side but for reasons I won't go into these are not good solutions in this case. So is there anything “built-in” to jqGrid that will help me preserve the state of grid so I can restore it again on return. The page number should be pretty easy to preserve, but what about search criteria the user may have entered to filter the grid in the first place. I realise this is quiet a broad question but your thoughts would be appreciated.

Regards,

Simon

Sorry, I appear to have posted this in the bugs forum when it really should have been in help

29/10/2009
08:49
Avatar
laubegaster
Member
Members
Forum Posts: 7
Member Since:
15/04/2009
sp_UserOfflineSmall Offline

Hi,

i have the same problem and found no solution... Frown

Maik

30/10/2009
06:52
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Also one possible solution is to use cockies and gridExport method. The grid export method will export the current state in grid as JSON string which can be asy loaded.

I'm not sure that this will do the job, since of cockie limitations - if I remember right it is about 4K.

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.

30/10/2009
12:21
Avatar
SimonL
Member
Members
Forum Posts: 39
Member Since:
23/07/2009
sp_UserOfflineSmall Offline

Hi Tony,

I don't think I need to go to that extreme of exporting/importing the whole grid configuration. But I have now begun to explore your idea of using cookies.

All I'm really trying to do is "remember" the search criteria the user has entered via the popup mutisearch form - which appears to be stored in postData. I am now writing the properties of postData to cookies, so that during the beforeRequest event I check the value of _search. If its true I write the postData properties back to the cookies because I assume the user has just used the popup multisearch form again to issue a new search. The grid then continues to load the data correctly. I've also added code to the onPaging event to set the page properties

            $('#list').setGridParam({ page: parseInt(requestedPage) });
            $('#list').setGridParam({ postData: { page: parseInt(requestedPage)} });

and everything works correctly.

I still have another couple of issues. One thing I need to do is programmtically clear the grid of its search criteria. The first thing I do is remove the cookies. But then I need to reset the properties of postData so the grid will load without applying any search criteria. I've been calling RemoveSearchCriteri() but when beforeRequest is fired, postData doesn't have the values I've set.

    function RemoveSearchCriteria() {
        ClearCookies();
        $('#list').setGridParam({ postData: { _search : false} });
        $('#list').setGridParam({ postData: { filters : ""} });
        $('#list').trigger("reloadGrid");
    }

The second problem is that even though the search criteria is being posted to the server correctly, when I click on the search toolbar - the form is not populated with the search criteria - its obviously not looking at postData to populate the form - what does it look for?

Can you help please ?

Regards,

Simon

31/10/2009
05:44
Avatar
SimonL
Member
Members
Forum Posts: 39
Member Since:
23/07/2009
sp_UserOfflineSmall Offline

Hi,

From reading another post I now see that my RemoveSearchCriteria should be as follows:

    function RemoveSearchCriteria() {
        ClearCookies();
        $('#list').setGridParam({ postData: { search : false} });
        $('#list').setGridParam({ postData: { filters : “”} });
        $('#list').trigger(”reloadGrid”);
    }

instead of

    function RemoveSearchCriteria() {
        ClearCookies();
        $('#list').setGridParam({ postData: { _search : false} });
        $('#list').setGridParam({ postData: { filters : “”} });
        $('#list').trigger(”reloadGrid”);
    }

now I've changed that the search criteria is now being cleared correctly. So my only remaining issue is repopulating the advanced search form with the save search criteria. Once again I see in another post in the help forum (save search parameters). That you recommend looking at the jquery.searchfilter.js which is what I will try next.

Regards,

Simon

03/11/2009
05:30
Avatar
SimonL
Member
Members
Forum Posts: 39
Member Since:
23/07/2009
sp_UserOfflineSmall Offline

Tony,

I wonder if you can help - as I stated in the previous posts I'm quite close to achieving my goals of saving the search criteria (whether it be to cookies or server side). Essentially when using multisearch: true - i.e. the advanced search. I want to enter the search criteria - save this criteria to cookies, then when I return to the page, retrieve the search criteria from the cookies so that when the grid calls the server for data it passes the correct search parameters to the server. As stated above I have all of this working correctly.  My only problem now is how do I "repopulate" the advanced search form with the search criteria. So when the user clicks on the search button the correct search criteria is in the form. I've looked at jquery.searchfilter.js but I'm new to JavaScript and I just don't know what I should call (should it be the searchFilter function ?). I've been struggling with this for a few days now - but getting nowhere - can you help please. When other people have asked about this your response was to take a look at jquery.searchfilter.js.  Would it be possible for you to give a little example of how we might repopulate the advanced search form.

Regards,

Simon

04/11/2009
04:48
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

To do what you want we need to add aditional procedure in jquery.searchFilter.js

Also another possible solution is to trigger clicking  on add button and fill the needed values.

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.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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