简体   繁体   English

jstree的dnd插件中的拖放事件不起作用

[英]Drag and Drop events in dnd plugin in jstree do not work

I am using jsTree for tree representation of the Files and folders. 我将jsTree用于文件和文件夹的树表示。 I would like move folders from one tree to the other. 我想将文件夹从一棵树移到另一棵树。

For this reason I have enabled the drag and drop plugin (dnd). 因此,我启用了拖放插件(dnd)。

Unfortunately it doesn't work if i also use the "types" plugin. 不幸的是,如果我也使用“类型”插件,那是行不通的。

Do you have any suggestion? 你有什么建议吗?

Thank you very much! 非常感谢你!

I am posting the related code below 我在下面发布相关代码

<script>

    function buildTrees() {


        var myTypes = {
            "mg1": {
                "max_depth": 1,
                "valid_children": ["ean"]
            },
            "ean": {
                "max_depth": 0
            },
            "aaa": {
                "max_depth": 2,


                "valid_children": ["mg1"]
            },
            "#": {
                "max_depth": 3,
                "valid_children": ["aaa"]
            }
        };


    }

   var sourceTree = $('#sourceTree').jstree({
            "core": {"check_callback": true}, "plugins": ["search", "wholerow", "dnd",   "checkbox", "types"] , "types": myTypes
        });

        var targetTree = $('#targetTree').jstree({
            "core": {"check_callback": true}, "plugins": ["search", "wholerow", "dnd", "checkbox", "types"] , "types": myTypes
        });



    $().ready(buildTrees());
</script>

There were some issues in jsTree when working with two instances of jsTree in the same doc, and especially when both instances have nodes with same IDs. 当在同一文档中使用jsTree的两个实例时,尤其是当两个实例具有相同ID的节点时,jsTree中存在一些问题。

Here are the related issues: 以下是相关问题:

https://github.com/vakata/jstree/issues/1013 - related to node IDs https://github.com/vakata/jstree/issues/1013-与节点ID相关

https://github.com/vakata/jstree/issues/1014 - related to types plugin https://github.com/vakata/jstree/issues/1014-与类型插件有关

Both issues are fixed and closed, thanks to the author! 感谢作者,这两个问题都是固定的和封闭的!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM