JQuery treeview - add node(s) in middle of tree
- by Chris
Hi all,
I'm just getting started with JQuery and the treeview plugin so this should be a relatively easy question:
The example code for adding branches to the tree:
var newnodes = $("<li><span class='folder'>New Sublist</span><ul>" +
"<li><span class='file'>Item1</span></li>" +
"<li><span class='file'>Item2</span></li></ul></li>").appendTo("#browser");
$("#browser").treeview({
add: branches
});
Works fine for me, but adds the new branch at the end of the tree - instead what I want is to be able to select a specific node and add to that branch.
I've managed to get the node being added by using the id of the particular node instead of the whole treeview in - appendTo("nodeID")
However I can't get the tree to render correctly, either with:
$("nodeID").treeview({
add: branches
});
or
$("browser").treeview({
add: branches
});
or calling it on both without arguments.
Cheers in advance