I'm trying to intercept the cellSubmit for a specific cell in jqGrid. I would like to override it in such a way that It allows me to handle my own submit using custom code.
But I only want to do this on a specific cell. The rest of the cells I would like to allow it to submit through jqGrids build in submit mechanisms. Is this possible? I've been going circles trying to find a solution.
Intercept the cellSubmit jqGrid
Asked Answered
You can implement your requirements in different way. If you just need to send custom data or custom serialized data in some cases it would be enough to use serializeCellData
callback. Probably beforeSaveCell
, beforeSubmitCell
or afterSaveCell
can be also helpful.
Alternatively you can "subclass" saveCell
function (see the answer, this one or another one as examples). The corresponding code could be like the following
var orgSaveCell = $.fn.jqGrid.saveCell;
$.jgrid.extend({
saveCell: function (iRow, iCol) {
var res;
// make some tests and do your own implementation of saveCell
// or call the original one
res = orgSaveCell.call (this, iRow, iCol);
// As one more option you can do some modification or do
// additional actions before calling of original saveCell
// or after it
return res;
}
});
© 2022 - 2024 — McMap. All rights reserved.