Combos in Grid change simultaneously
Hello, I have a grid with combo boxes in the first column. When I change the value of a combo box in one cell, then select a new value for a combo box in another cell, the text value of the previous combo box reverts back to its original value. I am using the code that Alex provided except for one small change. I have to call grid.refresh() at the end, otherwise the text values in my combo boxes will not change at all. I am using the following code:
comboText[<%=i%>] = "<%=goals[i].getLongNm()%>";
comboValue[<%=i%>] = "<%=goals[i].getGoalId()%>";
obj.setCellTemplate(new AW.Templates.Combo, 0);
obj.setPopupTemplate(function(col,row){
var grid = this;
var list = new AW.UI.List;
list.setItemText(comboText);
list.setItemValue(comboValue); list.setItemCount(<%=goals.length%>); list.onItemClicked=function(event, index){
var value = this.getItemValue(index);
var mytext = this.getItemText(index); grid.setCellText(mytext,col,row);
grid.setCellValue(value,col,row);
grid.getCellTemplate(col,row).hidePopup();
grid.refresh();
}
return list;
});
This is obviously not all of the code I use to create the grid, but just the section I am having difficulty with. I have to use this format because I have to set the cell value to be different than the cell text. The default popup template does not allow me to change the cell value, just the cell text. Any thoughts on this problem?
comboText[<%=i%>] = "<%=goals[i].getLongNm()%>";
comboValue[<%=i%>] = "<%=goals[i].getGoalId()%>";
obj.setCellTemplate(new AW.Templates.Combo, 0);
obj.setPopupTemplate(function(col,row){
var grid = this;
var list = new AW.UI.List;
list.setItemText(comboText);
list.setItemValue(comboValue); list.setItemCount(<%=goals.length%>); list.onItemClicked=function(event, index){
var value = this.getItemValue(index);
var mytext = this.getItemText(index); grid.setCellText(mytext,col,row);
grid.setCellValue(value,col,row);
grid.getCellTemplate(col,row).hidePopup();
grid.refresh();
}
return list;
});
This is obviously not all of the code I use to create the grid, but just the section I am having difficulty with. I have to use this format because I have to set the cell value to be different than the cell text. The default popup template does not allow me to change the cell value, just the cell text. Any thoughts on this problem?
Dean
February 21,