JsTree v3.0拖放插件。参考目标节点丢弃时 [英] JsTree v3.0 drag and drop plugin. Reference target node upon dropping

查看:425
本文介绍了JsTree v3.0拖放插件。参考目标节点丢弃时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 jsTree 库(ver。3.0)的拖放插件
使用以下内容代码我可以绑定到drag'n'drop动作的结尾,但我看不到一种方式来获得对目标节点(我正在丢弃的节点)的引用。

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 to the target node (the node I'm dropping on).

$(document).on('dnd_stop.vakata', function(e, data) {
   // how to get target_node here?
});


推荐答案

另一个解决方案是使用get_node()函数jstree对象。

Another solution is to use the get_node() function on the jstree object.

$(document).on('dnd_stop.vakata', function (e, data) {
    ref = $('#jstree').jstree(true);
    parents = ref.get_node(data.element).parent;
});

您可以通过以下方式获取所有家长:

You can get all parents with:

    all_parents = ref.get_node(data.element).parents;

这篇关于JsTree v3.0拖放插件。参考目标节点丢弃时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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