从一个dhtmlxTree拖放到另一个dhtmlxTree



我正在尝试从一个dhtmlxTree拖放到另一个。我只想拖动所选项目,而不是所选项目的同级项目,我该如何处理?我已经有了下一个:

tree = new dhtmlXTreeObject("tree_1","100%","100%",0);
tree.setImagePath("codebase/imgs/dhxtree_skyblue/");
tree.enableDragAndDrop(true);      //any
tree.loadXML("tree_dnd.xml");
tree.attachEvent("onDrag", function(sId, tId, id, sObject, tObject){
    return false
});
tree2 = new dhtmlXTreeObject("tree_2","100%","100%",0);
tree2.setImagePath("codebase/imgs/dhxtree_skyblue/");
tree2.enableDragAndDrop(true);
tree2.loadXML("tree_dnd.xml");

您可以这样做:

tree2.attachEvent("onDrag", function(sId, tId, id, sObject, tObject){
    if (sObject == tObject){
        return false;
    }
    else {
        tree2.insertNewItem(tId, id+"_new", tree.getItemText(sId));
        return false;
    }
});

相关内容

  • 没有找到相关文章

最新更新