jsTree drag and drop restrict folders by class

a 夏天 提交于 2019-12-23 20:13:59

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!