Converts Unordered List (ul element) into interactive tree.
Options may contain any of the following:
This converts a list into an interactive tree. listElement specifies an <ul> element in which your list lives. Argument collapse toggles initial collapsing of whole tree.
Tree data structure can be accessed and modified. See Example for usage.
Add attributes branchImg , toggleOpenImg and
toggleClosedImg , which would be appended to the
<li> tag. This way we can have any desired name
AND file format for the tree decoration.
var t1 = new OAT.Tree({imagePath:"images", // will take images from imagePrefix:"", ext:"gif"}); // images/Tree_*.gif var t2 = new OAT.Tree({imagePath:"images", // will take images from imagePrefix:"prefix", ext:"png"}); // images/Tree_prefix_*.png t1.assign("myUL1", true); // collapsed t2.assign("myUL2", false); // expanded var node1 = t1.tree.children[0]; var node2 = t2.tree.children[1]; node2.appendChild(node1); node1.setLabel("newLabel"); node2.expand(); node1.createChild("newLabel", true); // second argument means that new // child is a node rather than leaf node2.deleteChild(node1);