var myData = [
["1","one", "asdfadf", "fdgsdfga", "qwerqwer"],
["2", "two", "sdfdgv", "jsfghatb", "asdfasdf"],
["3", "three", "erttun", "uiypo", "dfghdfghd"],
["4", "four", "asdfyjh", "lkjlgjkl", "bvncbncbn"],
["5", "five", "sfgthnb", "vmnvbmnvbn", "dftynxb"],
];
var obj = new AW.Grid.Extended
obj.setSize(400,200); obj.setRowHeight(20);
obj.setId("defaultgrid");
obj.setCellText(myData);
obj.setVirtualMode(false); obj.setHeaderCount(1);
obj.setSelectorVisible(false); obj.setSelectionMode("single-cell");
obj.setHeaderText(['col1','col2','col3','col4','col5']);
obj.setColumnCount(5); obj.setColumnWidth([40,80,80,80,80]);
obj.setRowCount(5);
// Combo
var mycombo=new AW.Templates.Combo;
obj.setCellTemplate(new AW.Templates.Combo,1);
obj.getCellTemplate(1).setStyle("border","1px solid #999999");
if (AW.ie) {obj.getCellTemplate(1).setStyle("padding","0px");}
obj.setCellEditable(true,1);
obj.setPopupTemplate(function(col, row){
var list = new AW.UI.List;
list.setItemText(['one','two','three','four']); list.setItemCount(4);
list.setStyle("border","1px solid #999999");
list.setStyle('-moz-box-sizing','border-box');
list.setStyle('width','80px'); list.setStyle('height','80px');
list.onItemClicked = function(event, i){ try {
var t=this.getItemText(i);
obj.setCellText(t,col,row); // Runs text change event to get OLD value
obj.setCellValue(t,col,row); // Run change value event
obj.getCellTemplate(col,row).hidePopup(); // Hide Popup
} catch (e) { std_showerror(e,'cdaw_makegrid - list.onItemClicked'); }
}
//if (!AW.ie) {list.onControlMouseOut=function(event) { obj.getCellTemplate(col,row).hidePopup(); } }
return list;
});
document.write(obj);
var list = new AW.UI.List;
list.setItemText(['one','two','three','four']);
list.setItemCount(4);
list.setStyle("border","1px solid #999999");
list.setStyle('-moz-box-sizing','border-box');
list.setStyle('width','80px');
list.setStyle('height','80px');
obj.setPopupTemplate(list);
// replace default event handler assigned by setPopupTemplate(list)
list.onItemClicked = function(event, i){
try {
var t = this.getItemText(i);
this.$owner.setCellText(t, this.$0, this.$1);
this.$owner.setCellValue(t, this.$0, this.$1);
AW.$popup.hidePopup();
}
catch (e) {
//
}
}
This topic is archived.