Intercept the cellSubmit jqGrid

Intercept the cellSubmit jqGrid

本文关键字:jqGrid cellSubmit the Intercept      更新时间:2023-09-26

我正在尝试拦截jqGrid中特定单元格的cellSubmit。我想以这样一种方式覆盖它,它允许我使用自定义代码处理自己的提交
但我只想在一个特定的细胞上做这件事。我想允许它通过jqGrids内置提交机制提交其余的单元格。这可能吗?我一直在四处寻找解决方案。

您可以用不同的方式实现您的需求。如果在某些情况下只需要发送自定义数据定制序列化数据

或者,您可以"子类化"saveCell函数(见答案,这个或另一个作为示例)。相应的代码可能类似于以下

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;
    }
});