3.2.0

Deep Tree

Hello.

Not to be dense, but could someone show me how to make a tree with four hierarchical levels? I would have thought that this...

var tree = {
0: [1],
1: [2, 3, 4, 5],
2: [6, 7],
3: [8, 9, 10],
4: [11],
5: [12,[13,14]]
}

var obj = new AW.UI.Tree;
obj.setSize(300, 500);
obj.setItemText(["", "A", "B", "C", "D", "E", "F, "G", "H","I","J","K","L","X","Y"]);
obj.setItemImage(["", "home", "favorites", "fontsize", "search"]);
obj.setViewCount(function(i){return tree[i] ? tree[i].length : 0});
obj.setViewIndices(function(i){return tree[i]});
obj.setViewExpanded(true, 1); // Expand to first level by default
document.write(obj);

...would make X and Y the children of L, but apparently not.

Advice is appreciated.
Dvid
September 28,
The tree structure contains the arrays of child node indices for each parent node, so to make X and Y the children of L you have to add
...
12: [13,14], // 12 - 'L' node, 13 - 'X' node, 14 - 'Y' node
...
Alex (ActiveWidgets)
October 3,

This topic is archived.

See also:


Back to support forum