0

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

Dennis Williamson
  • 346,391
  • 90
  • 374
  • 439
Michel
  • 1

2 Answers2

4

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 Remember (persist) the filter, sort order and current page of jqGrid

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Than you for your interest. I will study this and give you a feedback. The WE starts now in Belgium -) – Michel Jul 09 '10 at 15:07
0

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.

Sergey Galashyn
  • 6,946
  • 2
  • 19
  • 39
  • 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 Jul 09 '10 at 15:09
  • When user comes back to the page -- build custom URL with stored in session values, like this `Act_country.cfc?method=getAllCountries&page=#session.page#&sidx=#session.sidx#&sort=#session.sort#` (do not use as is! re-check everything on server side) – Sergey Galashyn Jul 09 '10 at 16:42
  • My previous URL keys are from official website demos AJAX requests, but you should use the keys as your CFC expects. – Sergey Galashyn Jul 09 '10 at 16:44