3.0.0

getting all folder parents of selected child node

Is it possible to get all folder parents of selected child node
using the tree widget?

This is a must have... version 2.0.1

please help.
Gal L.
August 10,
To be able finding the parent of the current node you have to add a new property to the tree view model which contains child-parent relationship (inverse to the view indices array). This is likely to be the standard part of tree API in the future but the current version does not have it, so you have to define it with defineViewProperty() method.

var treeText = ["", "Home", "Favorites", "Font size", "Search", "Child node 1", "Child node 2"]; 
var treeImage = ["", "home", "favorites", "fontsize", "search"];

// child nodes
var treeView = {0:[1, 2, 3, 4], 1:[5, 6], 2:[7], 3:[8], 4:[9]};

// parent node
var treeParent = {1:0, 2:0, 3:0, 4:0, 5:1, 6:1, 7:2, 8:3, 9:4};

var tree = new AW.UI.Tree;
tree.setId("tree1");
tree.setItemText(treeText);
tree.setItemImage(treeImage);
tree.setViewCount(function(i){return treeView[i] ? treeView[i].length : 0});
tree.setViewIndices(function(i){return treeView[i]});

// add 'parent' property to the 'view' model

tree.defineViewProperty("parent");
tree.setViewParent(function(i){return treeParent[i]});

document.write(tree);

tree.onItemClicked = function(event, i){
    alert(this.getViewParent(i));
}
Alex (ActiveWidgets)
August 10,
This is a good example and has given me several pointers, but to save me wasting too much time 'discovering' the functionality or not some basic interface details would be useful ie methods, properties and events. the rest we can make a stab at working out for ourselves.
The value to me in buying a suite of components is the time saving over developing them ourselves. If we will have to spend too much time finding our way around it defeats the object.

Please, Please ...
Tim Edwards
January 2,

This topic is archived.

See also:


Back to support forum

Search

Version 2

Looking for AW 2.6 ?
The old site is here.