我有一个jsTree和一个DataTable。我正在尝试将我从树中拖动的节点复制到表中的单元格中。这样的事情可能吗?
它甚至不显示警报
这是在我的 html 中:
<li id="tree1" class="jstree-draggable">
</li>
<table id="table">
<thead>
<tr>
<th>1 Column</th>
<th>2 Column</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
这是我的 js:
$(document).ready(function() {
$("#tree1").jstree({
// List of active plugins
"plugins" : ["themes", "html_data", "dnd"],
"html_data" : {
"data" : "<li id='root'><a href='#'>Parent node</a><ul><li><a href='#'>Child node</a></li></ul></li>"
},
"themes" : {
"theme" : "default",
"dots" : true,
"icons" : true
},
"dnd" : {
"drop_finish" : function() {
alert("DROP");
},
"drag_check" : function() {
},
"drag_finish" : function (data) {
alert("DRAG FINISH");
}
},
"core" : {
"initially_open" : ["root"]
}
});
$('#table').dataTable({
"bPaginate" : false,
"bSort" : false,
"bInfo" : false,
"bFilter" : false
});
});
我有第二棵树(本质上是相同的)并且在它们两者之间拖放是有效的(除非我尝试将一个子元素放在它自己的父元素之一上,在这种情况下整个树都会消失,但那是现在不是我的主要问题)
我已经在这个线程上尝试了答案,但它仍然没有显示警报。
非常感谢有关如何解决此问题的任何帮助(它不必使用 jstree,这正是我碰巧找到的)