I am Use jqGrid.
$("#list").jqgrid(){
....
editurl:"editMedicineGridData.html",
onCellSelect : function(rowid, iCol, cellcontent) {
$('#prescribedDate').val(jQuery("#madicineGrid").jqGrid('getCell',rowid, 'PrescriptionDate'));
},
gridComplete: function(){
var grid = $("#madicineGrid"),
sum = grid.jqGrid('getCol','totalAmount', false, 'sum');
$('#totalMedicineCharge').html(sum);
},
ondblClickRow: function (rowid,name,val,iRow,iCol) {
$(this).jqGrid('editRow', rowid, true, null, null, null, {}, function (rowid) {
});
},
afterSaveCell : function(rowid,name,val,iRow,iCol) {
if(name == 'SaleQuantity') {
var Qval = jQuery("#madicineGrid").jqGrid('getCell',rowid,iCol+1);
var Aval = jQuery("#madicineGrid").jqGrid('getCell',rowid,iCol);
jQuery("#madicineGrid").jqGrid('setRowData',rowid,{totalAmount: parseFloat(Aval) * parseFloat(Qval)});
}
var grid = $("#madicineGrid"),
sum = grid.jqGrid('getCol','totalAmount', false, 'sum');
$('#totalMedicineCharge').html(sum);
}
});
so I want Update my data and Change it.
My Problem is that when I use Double Click row event i cant call afterSaveCell Event and When I use afterSaveCell Event Dosen`t Update my data.
I want Both.so What’s Solutions.
I wrote you before in the answer on your previous answer that you can’t mix inline editing with cell editing. The callback
afterSaveCellwill be called only if you use cell editing. So you should useaftersavefunccallback of editRow to recalculate contain of thetotalAmountcolumn based on new value from two other columns. For example if you have columnsamountandquantityand need recalculatetotalAmountbased on the new values from the columns you can do the following: