Add the following to the gridoption
onCellClick: function(value, record , cell, row, colNo, rowNo,columnObj,grid){
overRowNo=rowNo;
overColNo=colNo;
cellValue=value;
},
afterEdit: function( value, oldValue, record, col, grid){
// ordered trays calculation
if(overColNo == 5 || overColNo == 6){
var text = $(this.activeCell).find('div.gt-inner').text();console.log(text);
if (!$.isNumeric(text)){ //jquery's isnumeric function
alert ('Please enter a valid number.');
// because cell 5 is a drop down select we don't need to scan for bad input; this is only for cell 6 - ordered cells
text = 0;
}
var traycode = mygrid.getColumnValue(5,overRowNo);
var ordcells = mygrid.getColumnValue(6,overRowNo);
if (parseInt(traycode) >0) {
tray = parseInt(traycode);
} else {
tray=text;
}
if (parseInt(ordcells) >0) {
ordcell = parseInt(ordcells);
} else {
ordcell= $('input.gt-editor-text').first().val();
}
//alert(tray+' '+ordcell);
if (tray > 0 && ordcell > 0) var ordtrays = Math.ceil(ordcell/tray);
if (ordtrays > 0){
mygrid.setColumnValue('ordered_trays',overRowNo,ordtrays);
mygrid.updateEditState();
mygrid.activeRecord.ordered_trays = ordtrays;
mygrid.refresh();
}
}