Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is how I saved the state of my Grid (as json data in a hidden field though instead of localstorage, but the idea should be the same). </p> <p>Saving the Grid Parameters as JSON in the hidden field:</p> <pre><code> function saveGridParameters(grid) { var gridInfo = new Object(); gridInfo.url = grid.jqGrid('getGridParam', 'url'); gridInfo.sortname = grid.jqGrid('getGridParam', 'sortname'); gridInfo.sortorder = grid.jqGrid('getGridParam', 'sortorder'); gridInfo.selrow = grid.jqGrid('getGridParam', 'selrow'); gridInfo.page = grid.jqGrid('getGridParam', 'page'); gridInfo.rowNum = grid.jqGrid('getGridParam', 'rowNum'); gridInfo.postData = grid.jqGrid('getGridParam', 'postData'); gridInfo.search = grid.jqGrid('getGridParam', 'search'); $('#gridParams').val(JSON.stringify(gridInfo)); } </code></pre> <p>Loading the saved data: (I load the saved data in the beforeRequest event of the grid):</p> <pre><code> beforeRequest: function() //loads the jqgrids state from before save { if(gridParams !=null &amp;&amp; gridParams!="") { var gridInfo = $.parseJSON(gridParams); var grid = $('#ReportPartsGrid'); grid.jqGrid('setGridParam', { url: gridInfo.url }); grid.jqGrid('setGridParam', { sortname: gridInfo.sortname }); grid.jqGrid('setGridParam', { sortorder: gridInfo.sortorder }); grid.jqGrid('setGridParam', { selrow: gridInfo.selrow }); grid.jqGrid('setGridParam', { page: gridInfo.page }); grid.jqGrid('setGridParam', { rowNum: gridInfo.rowNum }); grid.jqGrid('setGridParam', { postData: gridInfo.postData }); grid.jqGrid('setGridParam', { search: gridInfo.search }); gridParams = ''; $('#ReportPartsGrid').trigger('reloadGrid'); } }, </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload