0

I am using free Jqgrid in Asp.net application (This is an old application). In application many .net server control with autopostback exist. So page get postback many times. and jqgrid load every time with ajax web method url.I want to keep JQgrid current state maintain like Selected row, filter, search, sorting.

I tried with some code for keep state maintain in loadcomplete. but it's not working for me.I stored selected row values with getGridparam in hidden field and then set with below code

my requirement is 1. Jqgrid should not refresh after whole page postback and it should remain persist

var gridInfo = $.parseJSON(Hiddedn field);                             
$('#GridViewJqgrid').jqGrid('setGridParam', { url: gridInfo.url });
$('#GridViewJqgrid').jqGrid('setGridParam', { sortname: gridInfo.sortname });
$('#GridViewJqgrid').jqGrid('setGridParam', { sortorder: gridInfo.sortorder });
$('#GridViewJqgrid').jqGrid('setGridParam', { selrow: gridInfo.selrow });
$('#GridViewJqgrid').jqGrid('setGridParam', { page: gridInfo.page });
$('#GridViewJqgrid').jqGrid('setGridParam', { rowNum: gridInfo.rowNum });
$('#GridViewJqgrid').jqGrid('setGridParam', { postData: gridInfo.postData });
$('#GridViewJqgrid').jqGrid('setGridParam', { search: gridInfo.search });
$('#Hiddedn field').val("");

I want Jqgrid current state should maintain like Selected row, page num and footer row, and filter

Dave
  • 3,073
  • 7
  • 20
  • 33
Ganesh S
  • 13
  • 2
  • Look at [the answer](https://stackoverflow.com/a/31663268/315935) and [the corresponding demo](http://www.ok-soft-gmbh.com/jqGrid/OK/ColumnChooserAndLocalStorage2_singleSelect.htm). It demonstrates how to save the state of grid in `localStorage` and to use at the next visit of the page. The button "x" in the navigator bar allows to clean the saved grid state. It's very close to your requirements. – Oleg Feb 16 '19 at 13:34
  • @Oleg ..Thanks a lot for reply I tried according to singlerow selection demo but getting error 'myColumnsState' is undefined .$(document).ready(function() { – Ganesh S Feb 16 '19 at 17:29
  • @Oleg.. Problem is solved ..It's working now. Thanks a lot... – Ganesh S Mar 10 '19 at 13:38
  • You are welcome! – Oleg Mar 10 '19 at 18:40
  • @Oleg..Can you please look into this question https://stackoverflow.com/questions/55088894/inline-jqgrid-row-should-rollback-after-error-response-from-server-webmethod-i and revert. – Ganesh S Mar 11 '19 at 11:02

0 Answers0