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 拖放插件.放置时参考目标节点


基础教程推荐
- Bootstrap 模态出现在背景下 2022-01-01
- Bokeh Div文本对齐 2022-01-01
- Fabric JS绘制具有活动形状的多边形 2022-01-01
- fetch 是否支持原生多文件上传? 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01
- npm start 错误与 create-react-app 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01
- 在 contenteditable 中精确拖放 2022-01-01
- 如何添加到目前为止的天数? 2022-01-01