jqGrid只允许1个排序方向 [英] jqGrid allow only 1 sort direction

查看:78
本文介绍了jqGrid只允许1个排序方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

jqGrid的排序图标同时显示向上和向下箭头.有没有一种方法可以强制图标仅显示1个方向,就像只允许升序一样?

jqGrid's sort icon on the column header shows both up and down arrows. Is there a way to force the icon to show only 1 direction like only allowing ascending order?

谢谢.

推荐答案

查看jqGrid事件文档此处.您可以通过在onSortCol事件上返回'stop'来定义自己的排序.这样的事情应该起作用:

Check out the jqGrid Event documentation here. You could define your own sorting by returning 'stop' on the onSortCol event. Something like this should work:

onSortCol: function (index, iCol, sortorder) {
    if (sortorder === "desc") {
            return 'stop';
    } else {
            //do regular sorting.
    }
}

此外,如果您在gridComplete上执行此操作,则它应该隐藏下降的箭头:

Also if you do this on gridComplete it should hide the descending arrows:

gridComplete: function () {
    $('.ui-grid-ico-sort.ui-icon-desc.ui-sort-ltr').hide();
}

这篇关于jqGrid只允许1个排序方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆