jqGrid: is there an event for when columns are reordered?

前端 未结 7 2277
走了就别回头了
走了就别回头了 2021-02-09 15:09

I\'m using the column reordering feature in jqGrid

$grid = jQuery(\"#list\").jqGrid({
    sortable:true,
    ...
});

Is there an event that fir

相关标签:
7条回答
  • 2021-02-09 15:42

    The comment given by @msanjay is the best way of doing this and here is the code which worked for me.

    var globalvar_sortingorder;
    
    jQuery('#gridId').jqGrid({
    .......
      sortable: { update: function(relativeColumnOrder) {
                        var grid = jQuery('#gridId');
                        var columnOrder=grid.jqGrid("getGridParam", "remapColumns");
                    // columnOrder now contains exactly what's necessary to pass to to remapColumns
                    // now save columnOrder somewhere
    
                globalvar_sortingorder=columnOrder;
    
                        }}
    ....
    });
    

    To restore the column order

    if(getObjectFromLocalStorage("sortingorder"))   {       
    jQuery('#gridId').jqGrid('remapColumns', globalvar_sortingorder, true, false);          
    }
    
    0 讨论(0)
提交回复
热议问题