Hi Mikesch,

getPreviousNodeOf does not necessarily return the parent node.

Given a tree like this:
1
1_1
1_1_1
1_2  
2

getPreviousNodeOf(1_1) 
--> 1
getPreviousNodeOf(1_2) 
--> 1_1
getPreviousNodeOf(2) 
--> 1_2

I believe what you are looking after is getParent() [1]. For example:

var hierarchy = [];
var item = tree.getSelection()[0];
hierarchy.unshift(item);
while (item.getParent()) { item = item.getParent(); hierarchy.unshift(item); }
hierarchy.map(function(item) {return item.getLabel()})

Provided "1_1_1" was selected, the last line would evaluate to
--> ["1", "1_1", "1_1_1]

Not sure this is what you're looking after?

Regards
Tristan

> While the function getHierachy is not avaible in the tree.Tree Class, i have
> tested with getPreviousNodeOf,
> but i dont find the right way :(


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to