:: Forum >>

How to dynamically create a tree ?

Can anybody give me an example on how to dynamically create a tree (e.g. a table of content, a list of books per author, etc) whitout having to pre-define the tree structure, e.g. because the content would be read from an xml file or be the result of a database query?

So, I wish I could do something like:

var MyTree = new Tree();

var t1 = new TreeItem();
MyTree.add(t1)
var t11 = new TreeItem(text11,action11); t1.add(t11);
var t12 = new TreeItem(text12,action12); t1.add(t12);

var t2 = new TreeItem();
MyTree.add(t2)
var t21 = new TreeItem(text21,action11); t2.add(t21);
var t22 = new TreeItem(text22,action12); t2.add(t22);
var t23 = new TreeItem(text23,action13); t2.add(t23);
.....


Many thanks in advance

Daniel
dvanesse
Monday, July 9, 2007
Have you tried counting the number of children under the parent node of your XML? If your schema allows it, that would be an easy workaround to get the size of your tree..

Best regards
ed
ed
Wednesday, September 12, 2007

This topic is archived.


Back to support forum

Forum search