0

i save jqGrid setting in localStorage after make column hide,show,resize and reordering them. all is done but colName cannot be saved in localStorage.

below my function which i used for save and load grid

function saveGrid(grid) 
{       
        var gridData = $('#grid').jqGrid('getGridParam');
    var gridDataAsString = JSON.stringify(gridData);
    localStorage.setItem("GridParam", gridDataAsString);
    getColumn();
}

function loadGrid()
{
        var loadedGridDataAsString = localStorage.getItem("GridParam");
    if (loadedGridDataAsString != null) 
    {
        var loadedGridData = JSON.parse(loadedGridDataAsString);
                $("#grid").jqGrid('setGridParam', loadedGridData);
            $("#grid").trigger('reloadGrid');       
         }
}
Oleg
  • 220,925
  • 34
  • 403
  • 798

1 Answers1

0

I think that there are misunderstanding about the usage of setGridParam and reloadGrid. Some options of jqGrid will be used only during creating of the grid. Some other options will be used during every filling of the grid. Only the subset of options can change results of the grid after reloadGrid.

So I recommend you to load the information from localStorage before creating of the grid.

If you really need to update column headers after grid is created you should do changes of the textes manually like in the answer.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798