JSTree拖放问题 [英] Issue with JSTree drag drop

查看:95
本文介绍了JSTree拖放问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将JSTree与ASP.net一起使用. 为树生成的html看起来像

I am using JSTree with ASP.net. The html generated for the tree looks like

    <ul>
            <li ID="Manager1"><a href="#">node 1</a></li>
            <li ID="Manager2"><a href="#">node 2</a></li>
            <li ID="Employee1"><a href="#">node 3</a></li>
            <li ID="Employee2"><a href="#">node 4</a></li>
            <li ID="Employee3"><a href="#">node 5</a></li>
    </ul>

当我将一个节点拖放到另一个节点上时,没有调用为drag_finish编写的函数. dnd plgin的用法如下,

When I Drag a node and drop on the other the function written for drag_finish is not getting called. The dnd plgin is used as below,

    tree.jstree({
        ...
         "dnd": {
            "drop_finish": function (data) {
                alert("some message");
            }

            }

        "plugins": [..., "dnd"]

    });

推荐答案

该错误与html有关.

The error is with the html.

对所有节点使用class ="jstree-drop"以及ID. 会起作用的.

Use class="jstree-drop" along with IDs for all the nodes. It will work.

另一种方法可能是 tree.bind("move_node.jstree",函数(事件,数据){ //您的代码 }

The other method could be with tree.bind("move_node.jstree", function (event, data){ // your code }

这篇关于JSTree拖放问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆