:: Forum >>

combobox in grid when starting editing

I am trying to do something like this (in a grid): changing the cell template to a combo when I start editing. To do that I save the current template, change it and restore it - it works fine once, the grid is not editable anymore. Any hint?

Thanks in advance

obj.onCellEditStarted = function(text, col, row){
cbj.evosTemplate= this.getCellTemplate(col,row);
cbj.evosRow= row;
cbj.evosCol= col;
cbj.evosGrid= this;
this.setCellTemplate(cbj,col,row);
this.refresh();
}

where cbj is defined like this:

var cbj = new AW.UI.Combo();
cbj.setId("myCombo");
cbj.setControlText("été");
cbj.setItemText(["Home", "été", "Font size", "Search"]);
cbj.setItemCount(4);
cbj.onItemClicked= function(event,index) {
if (this.evosTemplate) {
var selectedText = this.getItemText(index);
this.evosGrid.setCellTemplate(this.evosTemplate,this.evosCol,this.evosRow);
this.evosGrid.setCellText(selectedText, this.evosCol,this.evosRow);
this.evosGrid.refresh();
}
};

Philippe
Monday, March 20, 2006
I really did not test it this way, but I would use:
AW.Templates.Combo .. instead of...AW.UI.Combo
and with:
obj.onCellDoubleClicked ...instead of... obj.onCellEditStarted
try also ... obj.setEditionMode(false)
Hmmmm (not sure)
HTH

Carlos
Monday, March 20, 2006
Thanks Carlos.

Actually, it works great when using onCellEditStarting instead of onCellEditStarted !

obj.[b]onCellEditStarting [/b]= function(text, col, row){
cbj.evosTemplate= this.getCellTemplate(col,row);
cbj.evosRow= row;
cbj.evosCol= col;
cbj.evosGrid= this;
this.setCellTemplate(cbj,col,row);
this.refresh();
}
Philippe
Tuesday, March 21, 2006

This topic is archived.


Back to support forum

Forum search