jqGrid禁用sortablerows [英] jqGrid disable sortablerows

查看:157
本文介绍了jqGrid禁用sortablerows的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从网格禁用sortablerows功能.我希望能够启用/禁用sortablerows功能.启用该功能非常简单:

I'm trying to disable sortablerows functionality from a grid. I'd like to have the ability to toggle on/off the sortablerows functionality. Enabling the feature is pretty straightforward:

jQuery("#list").jqGrid('sortableRows', {
     update: function(event, ui) { updateOrder() }
});

但是,禁用该功能已被证明有点困难.我咨询过UI集成,其中jcGrid Wiki中记录了sortableRows:

But disabling the feature has proven to be a little bit harder. I've consulted the UI Integrations where sortableRows is documented in the jqGrid Wiki:

www.trirand.com/jqgridwiki/doku.php?id=wiki:jquery_ui_methods

www.trirand.com/jqgridwiki/doku.php?id=wiki:jquery_ui_methods

并发现该方法与jQuery UI可排序小部件完全兼容."因此,我冒险使用jQuery UI可排序文档,并发现了这一点:

And found that "The method is fully compatible with jQuery UI sortable widget." So I ventured off to the jQuery UI sortable documentation and found this:

http://jqueryui.com/demos/sortable/

jQuery("#list").jqGrid('sortableRows', {disabled: true});

上面的代码只是禁用行.所以我转到了destroy方法:

The code above simply disables the rows. So I moved onto the destroy method:

jQuery("#list").jqGrid('sortableRows', {destroy: true});

但是那什么也没做.根据文档,destroy方法似乎正是我所需要的,所以也许我的语法是错误的,但是我似乎无法使其正常工作.

but that doesn't do anything. Based upon the documentation the destroy method seems to be exactly what I need, so maybe my syntax is wrong but I can't seem to get it to work.

有人遇到过同样的问题吗?

Does anyone have experience with this same issue?

推荐答案

我花了一段时间才弄清楚这一点,但我明白了,这很简单.这就是您需要做的所有事情:

It took awhile for me to figure this one out but I got it and it's pretty simple. This is all you need to do:

$("#list tbody").sortable("destroy");

我最初的本能转向jQuery UI Sortable文档.我的语法不是.我翻遍了jqgrid JS文件,发现了这一点:

My initial instincts to turn to jQuery UI Sortable documentation were right on. My syntax wasn't. I dug through the jqgrid JS file and found this:

a("tbody:first", i).sortable(b)

然后指出了正确的方向.看来,琴身是整个烂摊子的铰链销.

Which then pointed me in the right direction. It appears that the tbody is the hinge pin to the entire mess.

并非所有人都在乎,但我认为我应该分享,以防其他人遇到类似的问题,而我的解决方案并非100%适合他们.

Not that anyone cares but I thought I should share in case someone else has a similar issue and my solution isn't a 100% fit for them.

任何人,谢谢大家的帮助.任务完成了.

Anywho, thanks for the help y'all. Mission accomplished.

这篇关于jqGrid禁用sortablerows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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