views:

48

answers:

2

Hi,

I would like not to lose the paging and the sort parameters when I leave a page with a grid and I come back to this page.

Is it possible to get the page, rowNum, sortname, sortorder params (I think with getGridParam), put them in the URL scope, go to another page, and get those params back through the URL scope and give them in the URL hereafter in the code ? (putting Act_country.cfc?method=getAllCountries&page=url.pageNum does not give anything...)

jQuery(document).ready(function(){  
    jQuery('#list').jqGrid({  
    url:'Act_country.cfc?method=getAllCountries',
    datatype: 'json',
    mtype:'GET',
    colNames:[
    '<cfoutput>#StLabels["LBL_TAB_EDIT"]#</cfoutput>',
    '<cfoutput>#StLabels["LBL_TAB_COUNTRY_CODE"]#</cfoutput>',
        ...

Thank you in advance, Michel

A: 

You need a Session scope.

Check the existence of params with StructKeyExists(Session, "param"), if they are not present yet -- consider this first visit and put the variables, otherwise use values from session. If user changes the paging/sorting -- refresh the values in the session.

Sergii
Thank you for your interest. This is a way to hold the parameters. But I would like to find a way to give them back to the grid, maybe as it is possible directly in the url that you can see in the code above...
Michel
Sergii
My previous URL keys are from official website demos AJAX requests, but you should use the keys as your CFC expects.
Sergii
+1  A: 

You can also save the information which you need in cookie. See http://www.intothecloud.nl/index.php/2010/04/saving-jqgrid-parameters-in-cookie/ or http://stackoverflow.com/questions/3015203/remember-persist-the-filter-sort-order-and-current-page-of-jqgrid

Oleg
Than you for your interest. I will study this and give you a feedback. The WE starts now in Belgium -)
Michel