问题描述
当我按列标题时,我试图触发onSortCol
事件.当前,当我单击列标题时,我可以看到一个请求发送到服务器,但是我希望在发生这种情况之前触发onSortCol
.我已经粘贴了下面的代码.
I am trying to get the onSortCol
event get fired when I press a column header. Currently, when I click a column header, I can see a request going to the server but I want the onSortCol
to be fired before this happens. I have pasted below the code I am using.
我错过了什么吗?我如何让onSortCol
工作?
Am I missing anything? How do i get onSortCol
to work?
jQuery("#list").jqGrid('navGrid', "#pager", { edit: false, add: false, del: false },
{onSortCol:function (index, columnIndex, sortOrder)
{
alert(index);
return 'stop';
}
});
推荐答案
您使用 onSortCol 错误.当前,您将 onSortCol 用作prmEdit
(窗体编辑参数)的 navGrid 方法的参数.尝试在jqGrid定义中包含onSortCol
:
You use onSortCol in a wrong way. Currently you use onSortCol as prmEdit
(form edit parameters) parameter of navGrid method. Try include onSortCol
in the jqGrid definition:
jQuery("#list").jqGrid({
// other parameters of jqGrid like colModel
onSortCol: function (index, columnIndex, sortOrder) {
alert(index);
return 'stop';
}
});
这篇关于JQGrid排序-如何触发onSortCol事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!