JsTree v3.0 drag and drop plugin. Reference target node upon dropping(JsTree v3.0 拖放插件.放置时参考目标节点)
问题描述
我使用 jsTree 库的拖放插件(版本 3.0)使用以下代码,我可以绑定到拖放操作的末尾,但我看不到获取对目标节点(我要放置的节点)的引用的方法.
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?
});
推荐答案
另一种解决方案是在jstree对象上使用get_node()函数.
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;
});
您可以让所有父母:
all_parents = ref.get_node(data.element).parents;
这篇关于JsTree v3.0 拖放插件.放置时参考目标节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:JsTree v3.0 拖放插件.放置时参考目标节点


- 为什么我的页面无法在 Github 上加载? 2022-01-01
- 我不能使用 json 使用 react 向我的 web api 发出 Post 请求 2022-01-01
- 如何向 ipc 渲染器发送添加回调 2022-01-01
- 如何调试 CSS/Javascript 悬停问题 2022-01-01
- 如何显示带有换行符的文本标签? 2022-01-01
- 为什么悬停在委托事件处理程序中不起作用? 2022-01-01
- 在不使用循环的情况下查找数字数组中的一项 2022-01-01
- 从原点悬停时触发 translateY() 2022-01-01
- 是否可以将标志传递给 Gulp 以使其以不同的方式 2022-01-01
- 使用 iframe URL 的 jQuery UI 对话框 2022-01-01