3.0.4

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
March 20,
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
March 20,
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
March 21,

This topic is archived.

See also:


Back to support forum