JsTree v3.0 drag and drop plugin. Reference target node upon dropping

后端 未结 8 938
南笙
南笙 2021-01-12 09:30

I use drag and drop plugin of jsTree library (ver. 3.0) With the following code I can bind to the end of drag\'n\'drop action, but I can not see a way to get the reference t

8条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-12 10:25

    $(document).on('dnd_stop.vakata', function(e, data) {
        var inst = $.jstree.reference('#jstree');
        console.log("END DROP:");
        var sourceID = data.data.nodes[0];
        console.log("Source ID: " + sourceID);
        var targetNode = inst.get_node(data.event.target, true);
        var targetID = targetNode[0].id;
        console.log("Target ID: " + targetID);
    });
    

提交回复
热议问题