// turn off double-click
obj.onCellDoubleClicked = function(event, col, row) {
return true; // cancels further processing
}
obj.setCellEditable(false);
var MyInput = new AW.UI.Input;
var lastcol="";
var lastrow="";
var defaultcelltemplate = obj.getCellTemplate(0,0);
obj.onCellClicked = function(event, col, row){
obj.setCellTemplate(defaultcelltemplate, lastcol, lastrow);
obj.getCellTemplate(lastcol, lastrow).refresh();
obj.setCellTemplate(MyInput , col, row);
obj.getCellTemplate(col, row).refresh();
lastcol = col;
lastrow = row;
}
obj.setCellEditable(false);
var MyInput = new AW.UI.Input;
var lastcol=0;
var lastrow=0;
var defaultcelltemplate = obj.getCellTemplate(0,0);
var NrColumns = obj.getColumnCount()
obj.onCellClicked = function(event, col, row){
for(var x=0; x< NrColumns; x++) {
obj.setCellTemplate(defaultcelltemplate, x, lastrow);
obj.getCellTemplate(x, lastrow).refresh();
}
for(var x=0; x< NrColumns; x++) {
obj.setCellTemplate(MyInput, x, row);
obj.getCellTemplate(x, row).refresh();
}
lastcol = col;
lastrow = row;
}
obj.setCellEditable(false);
var editor = new AW.UI.Input; // editor cell template
var cell = obj.getCellTemplate(0,0); // default cell template
var lastcol="";
var lastrow="";
obj.onCellClicked = function(event, col, row) {
// no editing for cols 0 & 1
if(col > 1) {
this.$edit = false;
obj.setCellTemplate(cell, lastcol, lastrow);
obj.getCellTemplate(lastcol, lastrow).refresh();
obj.setCellTemplate(editor, col, row);
obj.getCellTemplate(col, row).refresh();
var text = editor.element().getElementsByTagName("input")[0];
this.$edit = true;
this.timeout(function(){
text.focus();
text.select();
text = null;
});
lastcol = col;
lastrow = row;
}
}
editor.setTimeout(function()
{ editor.startEdit(); });
This topic is archived.