3.2.0

Tree with multiple level

Is it possible to create tree with multiple level ?
like this :
- a
- a1
a21
a22

Thanks

Karine
December 29,
Do you mean something like this:

1) Level 1
1a) sub level 1a
1a1) Sub Sub level 1a1
2) Level 2
3) Level 3
3a) sub level 3a

Is this what you mean? Then I think the answer is yes. You control the levels via the numeric index that you pass to setViewIndices. The above example would look like this:

var titles_array['', 'Level 1','Level 2','Level 3','sub level 1a','Sub Sub level 1a1','sub level 3a'];
var index_array={ 0:[1,2,3], 1:[4], 3:[6], 4:[5] }

From my testing, the order of the numeric indexes is not totally important. Neither is the order of the titles. As long as the logic ties them all together correctly.

Jim Hunter
December 30,
It works, thank you Jim :-)
This is the complete code :

var tree = {
        0: [1, 2, 3],
        1: [4],
        2: [7],
        3: [8],
        4: [5,6],
        
    }
    var obj = new AW.UI.Tree;
    obj.setItemText(["", "A", "B", "C", "A1", "A11", "A12", "B1", "C1"]);
    obj.setViewCount(function(i){return tree[i] ? tree[i].length : 0});
    obj.setViewIndices(function(i){return tree[i]});
    document.write(obj);


Karine
December 30,

This topic is archived.

See also:


Back to support forum