开发者

jstree - creating foreign draggable object after the tree is initialized

开发者 https://www.devze.com 2023-03-24 04:02 出处:网络
I was able to successfully init all the examples of jsTree, but there was no example on how to create a new div on-the-fly and have it as a legitimate object for dropping into jsTree.

I was able to successfully init all the examples of jsTree, but there was no example on how to create a new div on-the-fly and have it as a legitimate object for dropping into jsTree.

I tried playing a bit with drag_target, dnd_prepare but no luck.

I tried this code:

"dnd" : {
            "drop_finish" : function () { 
            alert("DROP"); 
        },
        "drag_check" : function (data) {
            alert("drag_check");
            if(data.r.attr("id") == "phtml_1") {
                return false;
            }
            return { 
                after : false, 
                before : false, 
       开发者_如何学C         inside : true 
            };
        },
        "drag_finish" : function (data) { 
            alert("DRAG OK"); 
        }

But none of the alert boxes was called.

(I am referring to http://www.jstree.com/documentation of course)


ok I've found my mystake. One set class as 'jstree-draggable' on another div which will serve as the basis for cloning

0

精彩评论

暂无评论...
验证码 换一张
取 消