<style>
#myCombo-popup .aw-items-selected {background: #ccc}
</style>
<script>
var combo = new AW.UI.Combo;
combo.setId("myCombo");
combo.setItemText(function(i){return "item" + i});
combo.setItemCount(30);
combo.setSelectionMode("multi");
combo.onCurrentItemChanged = null;
combo.onSelectedItemsChanged = function(items){
var i, a = [];
for (i=0; i<items.length; i++){
a[i] = this.getItemText(items[i]);
}
this.setControlText(a.join(", "));
}
document.write(combo);
</script>
var list = new AW.UI.List;
list.setItemText(function(i){return "item" + i});
list.setItemCount(30);
list.setSelectionMode("multi");
list.onControlActivating = function(){
this.lock();
}
list.onSelectedItemsChanged = function(items){
try {
var i, a = [];
for (i=0; i<items.length; i++){
a[i] = this.getItemText(items[i]);
}
var s = a.join(", ");
this.$owner.setCellText(s, this.$0, this.$1);
var e = this.$owner.getCellTemplate(this.$0, this.$1).getContent("box/text").element();
if (AW.ie){
e.innerHTML = s;
}
else {
e.value = s;
}
e = null;
}
catch(err){
// ignore errors
}
}
var obj = new AW.UI.Grid;
obj.setCellData(function(col, row){return col + "." + row});
obj.setHeaderText("header");
obj.setColumnCount(10);
obj.setRowCount(10);
obj.setCellEditable(true);
obj.setCellTemplate(new AW.Templates.Combo, 1);
obj.onPopupTemplateChanged = function(){return true}; // cancel the default handler
obj.setPopupTemplate(list, 1);
document.write(obj);
var list = new AW.UI.List;
var array = [3, 5, 8];
list.setSelectedItems(array);
This topic is archived.