There are 2 trees. The Tree Tree and the Category Tree , the node in both trees can be moved (reordered) in the tree itself, and the node tree from the category tree can be moved (drag and drop) to the menu tree. I bind the move_node callback, every time a node is dragged and dropped in its tree or node is dragged and deleted on another tree, this callback is executed. My code is:
.bind("move_node.jstree", function (e, data) {
data.rslt.o.each(function (i) {
$.ajax({
async : false,
type: 'POST',
url: "/menus/move/",
dataType: 'json',
data : {
"operation" : "move_node",
"id" : $(this).attr("id").replace("node_",""),
"parent" : data.rslt.cr === -1 ? 1 : data.rslt.np.attr("id").replace("node_",""),
"oldParent" : data.rslt.op.attr("id").replace("node_",""),
"position" : data.rslt.cp + i,
"oldPosition" : data.rslt.cop,
"title" : data.rslt.op.children("a").text()
} });
});
})
How can I detect this node move for another tree or for the same tree.
source
share