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);
This topic is archived.