General TreeV3.js source code method query
Here's a snippet from TreeV3.js, which I have traced down as the culprit for moving a node to its destination on drop. What does the "this.doMove.apply" call do? I see there's a doMove method, but what does "apply" do to it??
What I am aiming for is for the addchild event to be called and the info sent to the server, but not actually HAPPEN on the screen, so I can map 2 elements together in my database based on their ids
move:function (child, newParent, index) {
if (!child.parent) {
dojo.raise(this.widgetType + ": child can be moved only while it's attached");
}
alert('inside Tree move');
var oldParent = child.parent;
var oldTree = child.tree;
var oldIndex = child.getParentIndex();
var newTree = newParent.tree;
var newParent = newParent;
var newIndex = index;
var message = {oldParent:oldParent, oldTree:oldTree, oldIndex:oldIndex, newParent:newParent, newTree:newTree, newIndex:newIndex, child:child};
dojo.event.topic.publish(oldTree.eventNames.beforeMoveFrom, message);
dojo.event.topic.publish(newTree.eventNames.beforeMoveTo, message);
this.doMove.apply(this, arguments);
dojo.event.topic.publish(oldTree.eventNames.afterMoveFrom, message);
dojo.event.topic.publish(newTree.eventNames.afterMoveTo, message);
}, doMove:function (child, newParent, index) {
child.doDetach();
newParent.doAddChild(child, index);
}
Dojo Forum