obj.onKeyTab = function(event){
var col=obj.getCurrentColumn();
var CI=obj.getColumnIndices()
col=(col*1);
for(i=0;i<CI.length;i++){
if(col==CI[i]) {break;}
}
if(col!=CI[CI.length-1]){
col=CI[i+1];
setTimeout("myGrid.focus();obj.setSelectedColumns(["+col+"]);obj.setCurrentColumn("+col+");",100);
} else {
if(obj.getCurrentRow()<(obj.getRowCount()-1)){
col=CI[0];
setTimeout("myGrid.focus();obj.setCurrentRow("+(obj.getCurrentRow()+1)+");obj.setCurrentColumn("+col+");obj.setSelectedColumns(["+col+"]);obj.setSelectedRows(["+(obj.getCurrentRow()+1)+"]);",100);
} else {
//Code to execute after tab in last cell
obj.setSelectedColumns([0]); //Remove selection from grid
setTimeout("parent.document.forms[0].btnAddLine.focus();",100); //In this case, focussing a button in another frame...
//End code to execute after tab in last cell
}
}
}
obj.onKeyShiftTab = function(event){
var col=obj.getCurrentColumn();
var CI=obj.getColumnIndices();
col=(col*1);
for(i=1;i<CI.length;i++){
if(col==CI[i]) {break;}
}
if (i==CI.length) {
var row=obj.getCurrentRow();
if(row>0){
setTimeout("myGrid.focus();obj.setCurrentRow("+(obj.getCurrentRow()-1)+");obj.setSelectedRows(["+(obj.getCurrentRow()-1)+"]);",100);
col=CI[i-1];
setTimeout("myGrid.focus();obj.setSelectedColumns(["+col+"]);obj.setCurrentColumn("+col+");",100);
} else {
//Code to execute after the first cell was shift-tabbed
obj.setSelectedColumns([0]); // remove selection from grid
//End-code to execute after the first cell was shift-tabbed
}
} else {
col=CI[i-1];
setTimeout("myGrid.focus();obj.setSelectedColumns(["+col+"]);obj.setCurrentColumn("+col+");",100);
}
}
This topic is archived.