This fiddle attempts to access the modified tree data and display it to console when a node is moved and/or dropped :
The tree in question is based on jqTree : https://mbraak.github.io/jqTree/
http://jsfiddle.net/adrianfiddleuser/ywo3z1rb/3/
But the alert is not firing.
fiddle src :
HTML :
<div id="tree1"></div>
javascript + jQuery :
var data = [
{
label: 'node1',
children: [
{ label: 'child1' },
{ label: 'child2' }
]
},
{
label: 'node2',
children: [
{ label: 'child3' }
]
}
];
$('#tree1').tree({
data: data,
autoOpen: true,
dragAndDrop: true,
"check_callback" : true
}).on("copy_node.jstree", function () {
alert("copy_node fires");
console.log(data)
}).on("move_node.jstree", function () {
alert("move_node fires");
console.log(data)
});
How to fire the alert and access the modified tree json structure ? I'm not using on
correctly ?