jsTree拖放按类限制文件夹 [英] jsTree drag and drop restrict folders by class
问题描述
如何通过类名class ="locked"锁定文件夹上的拖动功能? 同时锁定其他文件夹,将其拖放到该文件夹中class ="locked".
How can you lock the drag function on a folder by class name class="locked"? And on the same time lock other folders to be draged into this folder class="locked".
我想要一个同时具有拖放功能和上下文菜单的设置. 如果该节点的类名称为"locked",那么我只想禁用对contextmenu的编辑,并且既不能将其拖到该文件夹中,也可以将该文件夹拖到新位置.
I want a setup where I have both drag and drop, and contextmenu. If the node has the class name "locked" I just want to disable editing for both contextmenu and possibility to drag into this folder or drag this folder to new location.
Tnx
推荐答案
使用CRRM插件结合.get_move()的核心文档找到了一种方法.
Found a way by using the CRRM plugin combined with core documentation for .get_move().
.o"是要移动的节点,.r"是移动中的参考节点.
".o" is the node being moved, and ".r" is the reference node in the move.
http://www.jstree.com/documentation/core
http://www.jstree.com/documentation/crrm
这是我的代码:
"crrm" : {
"move" : {
"default_position" : "first",
"check_move" : function (m) {
return (m.o.hasClass("locked") || m.r.hasClass("locked")) ? false : true;
}
}
}
这篇关于jsTree拖放按类限制文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!