3.2.0

How do you set links for a tree object?

Say this is my tree, how would i set links for each tree item?

Thanks
-dp

var tree = {
0: [1, 2, 3, 4],
1: [5, 6],
2: [7],
3: [8],
4: [9]
}

var obj = new AW.UI.Tree;
obj.setItemText(["", "Home", "Favorites", "Font size", "Search", "Child node 1", "Child node 2"]);
obj.setItemImage(["", "home", "favorites", "fontsize", "search"]);
obj.setViewCount(function(i){return tree[i] ? tree[i].length : 0});
obj.setViewIndices(function(i){return tree[i]});
document.write(obj);

DP
July 6,
Here is the answer:

var obj = new AW.UI.Tree;
obj.setItemText(["", "Size", "Shape", "Color", "Large", "Medium", "Small", "squrare", "circle","red","green","blue" ]);
obj.setItemLink("http://www.google.com",1)


obj.onItemClicked = function(event, i){
window.location = this.getItemLink(i);
}
obj.setViewCount(function(i){return tree[i] ? tree[i].length : 0});
obj.setViewIndices(function(i){
//alert(i)
return tree[i]});
document.write(obj);
DP
July 7,
Yes, this is probably the best solution because the standard 'link' template (AW.Templates.Link) will not work inside trees.
Alex (ActiveWidgets)
July 9,
Hey if you want to get down in the hierarchy and then have a file to be displayed when a node in the tree is clicked.

for example in the example in the first post
home has two sub elements, then if we click on that a event should be fired.
how to go to the sub element and then fire the event

Thanks,
NS
NS
August 9,

This topic is archived.

See also:


Back to support forum