HRI
HRI

Reputation: 91

move a node and keep its old Id

hello i need to do the following: move a node from jstree to another jstree but i need to show the nodes in both of the trees but when i set

"crrm": {
                "move": {
                    "always_copy": "multitree"
          }
}

i always get a copy_Id as an id of the node being moved. I need to keep the old id. how can i do this?

i tried this but it doesn't work:

$('#SecondTree').jstree({

"crrm": {
                    "move": {
                        "always_copy": "multitree"
              }
    }).bind("move_node.jstree", function (e, data) {

             var copyNode = data.rslt.o.attr("id");
             data.rslt.o.find("li").attr("id",copyNode); 
}

thank you in advanced

Upvotes: 1

Views: 358

Answers (1)

Zheileman
Zheileman

Reputation: 2559

You can't have duplicate element IDs. That's invalid HTML and jQuery/javascript or the jsTree plugin will end having problems. In summary, you will not know how it's going to behave.

jsTree will probably never generate duplicate nodes with duplicate IDs. If you want to refer two nodes as being 'sort of' the same (but in reality they are not) you can use duplicate classNames, but no IDs.

Upvotes: 1

Related Questions