I’m trying to setup drag n drop inside a jstree. I want it so that the nodes can only be moved, not reordered.
My check_move function looks like this:
"crrm" : {
"move" : {
"check_move" : function (m) {
if(m.p == "inside")
return true;
else
return false;
}
}
},
However this doesn’t appear to be working. The tree never moves the nodes, and the move_node event is never fired.
I have a JSFiddle setup to demonstrate what I mean: http://jsfiddle.net/PJcHm/1/ Try dragging and dropping to move Node 2 inside of Node 1.
I figured it out after a little debugging. It looks like after releasing to drop the node inside another node, the
check_movefunction is called one more time, with the level variablepequal to"last". So I was returning false for that. The proper code is: