:: Forum >>

Can't change the whole tree in AW.UI.Tree

Hey, just wondring if it possibly to get help with this.

I'am running AW 2.53 and firefox on vista.

I'am trying to "live" update the whole tree structure, and something is tweeking, because when I push button for update, AW.UI.Tree get lost or maybe I am. But it is something wrong.

var aryText = ['','1','2','3','4','5','6','7','8','9'];
        var aryView = {0:[1,2,3],1:[4,5,6],2:[7,8,9]};

        var tree = new AW.UI.Tree;
        tree.setId('tree');
        tree.setItemText(aryText);
        tree.setViewCount(function(i){return aryView[i] ? aryView[i].length : 0});
        tree.setViewIndices(function(i){return aryView[i]});
        tree.setCurrentItem(1);
        tree.setStyle('position', 'absolute');
        tree.setStyle('left', '16px');
        tree.setStyle('top', '62px');
        tree.setStyle('width', '200px');
        tree.setStyle('height', '525px');
        document.write(tree);
    
        var btnUtfor = new AW.UI.Button;
        btnUtfor.setId('btnUtfor');
        btnUtfor.setControlText('Utfør kode');
        btnUtfor.setStyle('position', 'absolute');
        btnUtfor.setStyle('left', '300px');
        btnUtfor.setStyle('top', '460px');
        btnUtfor.setStyle('width', '200px');
        btnUtfor.onControlClicked = function(event){
            aryText = ['','11','12','13','14','15','16','17','18','19'];
            aryView = {0:[1,2,3,4,5,6,7,8,9]};
            //aryText = ['', 'Database', 'Version','Last queries','Last warnings','Last error'];
            //aryView = {0:[1], 1:[2,3,4,5]};
            //alert(aryView[0]);
            //alert(aryView.length);
            //aryView.length=20;
            var obj=AW.object('tree');
            obj.setItemText(aryText);
            obj.setViewCount(function(i){return aryView[i] ? aryView[i].length : 0});
            obj.setViewIndices(aryView);
            obj.setCurrentItem(1);
            obj.refresh();
        }
        document.write(btnUtfor);


Thanks
Oddbjørn
Monday, August 17, 2009
Just replace the line:
obj.setViewIndices(aryView);
with:
obj.setViewIndices(function(i){return aryView[i]});
Carlos
Monday, August 17, 2009
uhhh embarassing, but still thanks a lot.
Oddbjørn
Tuesday, August 18, 2009

This topic is archived.


Back to support forum

Forum search