jqGrid - Is it possible to set onSortCol after init?

与世无争的帅哥 提交于 2020-01-04 14:05:55

问题


I've looked through the jqGrid documentation and a few other SO questions, and pretty much the only documented way to handle onSortCol is when you initialize the grid, ie:

var myGrid = $("#gridid").jqGrid({
   //...
   onSortCol: function(index, iCol, sortorder) { ... }
});

Is there a way to bind to the onSortCol event through the myGrid reference, after the grid has already been initialized?

Something like:

myGrid.onSortCol(function (index, iCol, sortorder)
   {
      //...
   }
);

Thanks!


回答1:


I found one solution. This appears to work well:

 myGrid.setGridParam({
     onSortCol: function(index, iCol, sortorder)
     {
         alert("Hello");
     }
 });


来源:https://stackoverflow.com/questions/11142933/jqgrid-is-it-possible-to-set-onsortcol-after-init

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!