本文介绍了jqGrid - 初始化后是否可以设置onSortCol?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我查看了和其他一些SO问题,以及处理 onSortCol 的唯一记录方法是初始化网格时,即:

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) { ... }
});

有没有办法绑定到 onSortCol 网格初始化后,通过 myGrid 引用事件?

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

类似:

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

谢谢!

推荐答案

我找到了一个解决方案。这似乎运作良好:

I found one solution. This appears to work well:

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

这篇关于jqGrid - 初始化后是否可以设置onSortCol?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 21:16