Search code examples
javascriptjqueryjstree

Why does binding "move_node.jstree" only fire once, for the first node, when moving a group of nodes?


Can anyone tell me why binding "move_node.jstree" only fires once, for the first node, when moving a group of nodes? and how can I detect All the nodes that were moved?

I need to detect All nodes that were moved so that I can report back via a custom ajax function. This is what I am using at the minute but it only runs for the first node out of my selection of nodes that are moved at the same time.

.bind("move_node.jstree", function (e, data) {
            /*
            data.rslt contains: 
            .o - the node being moved 
            .r - the reference node in the move 
            .ot - the origin tree instance 
            .rt - the reference tree instance 
            .p - the position to move to (may be a string - "last", "first", etc) 
            .cp - the calculated position to move to (always a number) 
            .np - the new parent 
            .oc - the original node (if there was a copy) 
            .cy - boolen indicating if the move was a copy 
            .cr - same as np, but if a root node is created this is -1 
            .op - the former parent 
            .or - the node that was previously in the position of the moved node 
            */
            var eventID = data.rslt.o.attr("id").substring(11);
            var groupID = data.rslt.np.attr("id").substring(11);
            commitEventMove(eventID,groupID);
            //alert("bind-move_node fired");
           })

Solution

  • Finally after a day and a half I have found the right issue number! :-D if you have same problem check it out for solution:

    http://code.google.com/p/jstree/issues/detail?id=805

    This guy best put together a decent set of documentation when the new version is released because the current one has issues.