RC1 Example & Question: Combo in a grid column.
I confirmed this example of a combo in a grid column works in RC1. However, I need help with an enhancement.
The dropdown box appears all the time.
How do I make the dropdown only appear for just the cell being edited?
Just a few notes:
This sample is for the case where the same dropdown is used for every cell of a column. My understanding is that by creating the template you will get good performance regardless of the number of rows.
I got this code from Alex's post in:
http://www.activewidgets.com/javascript.forum.8762.6/which-way-to-set-a.html
The dropdown box appears all the time.
How do I make the dropdown only appear for just the cell being edited?
<html>
<head>
<script src="runtime/lib/aw.js"></script>
<link href="runtime/styles/xp/aw.css" rel="stylesheet"></link>
</head>
<body>
<script>
var HeaderText = ["Number","Description"];
var CellText = [
["1","Description 1"],
["2","Description 2"],
["3","Description 3"],
["4","Description 4"],
["5","Description 5"]
];
var obj = new AW.UI.Grid;
obj.setHeaderText(HeaderText);
obj.setCellText(CellText);
obj.setColumnCount(2);
obj.setRowCount(5);
// BEGIN COMBO POPUP CODE
rowCombo = new AW.Templates.Combo;
obj.setCellTemplate(rowCombo, 1);
obj.setPopupTemplate(function(col, row){
var grid = this;
var list = new AW.UI.List;
list.setItemText(["text1", "text2", "text3"]);
list.setItemCount(3);
list.onItemClicked = function(event, i){
var text = this.getItemText(i);
grid.setCellText(text, col, row);
grid.setCellValue(text, col, row);
grid.getCellTemplate(col, row).hidePopup();
}
return list;
});
// END COMBO POPUP CODE
document.write(obj);
</script>
</body>
</html>
Just a few notes:
This sample is for the case where the same dropdown is used for every cell of a column. My understanding is that by creating the template you will get good performance regardless of the number of rows.
I got this code from Alex's post in:
http://www.activewidgets.com/javascript.forum.8762.6/which-way-to-set-a.html
Rob Francis
February 2,