AW.Tree.Combo = AW.UI.Tree.subclass();
AW.Tree.Combo.create = function(){
AW.UI.ImageText.create.call(this);
AW.UI.Input.create.call(this);
AW.Templates.Combo.create.call(this);
var obj = this.prototype;
obj.setClass("ui", "combo");
obj.setClass("input", "");
obj.defineTemplate("popup", new AW.Templates.Frame);
obj.onCurrentItemChanged = function(i){
var text = this.getItemText(i);
this.setControlText(text);
this.hidePopup();
var e = this.getContent("box/text").element();
e.value = text;
e.select();
e = null;
};
obj.setController("selection", {
onItemClicked: "selectClickedItem"
});
};
var treeText = ["", "Home", "Favorites", "Font size", "Search", "Child node 1", "Child node 2"];
var treeImage = ["", "home", "favorites", "fontsize", "search"];
var treeView = {0:[1, 2, 3, 4], 1:[5, 6], 2:[7], 3:[8], 4:[9]};
var tree = new AW.Tree.Combo;
tree.setId("tree1");
tree.setItemText(treeText);
tree.setItemImage(treeImage);
tree.setViewCount(function(i){return treeView[i] ? treeView[i].length : 0});
tree.setViewIndices(function(i){return treeView[i]});
document.write(tree);
This topic is archived.