问题
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".
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
回答1:
Found a way by using the CRRM plugin combined with core documentation for .get_move().
".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
Here is my code:
"crrm" : {
"move" : {
"default_position" : "first",
"check_move" : function (m) {
return (m.o.hasClass("locked") || m.r.hasClass("locked")) ? false : true;
}
}
}
来源:https://stackoverflow.com/questions/8374452/jstree-drag-and-drop-restrict-folders-by-class