拦截cellSubmit jqGrid [英] Intercept the cellSubmit jqGrid

查看:51
本文介绍了拦截cellSubmit jqGrid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试拦截jqGrid中特定单元格的cellSubmit.我想以某种方式覆盖它,它允许我使用自定义代码处理自己的提交.
但是我只想在特定的单元格上执行此操作.我想允许其其余的单元格通过内置的提交机制通过jqGrids提交.这可能吗?我一直在努力寻找解决方案.

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.

推荐答案

您可以用不同的方式实现您的要求.在某些情况下,如果只需要发送自定义数据自定义序列化数据,那么使用serializeCellData回调就足够了.可能beforeSaveCellbeforeSubmitCellafterSaveCell也可能有帮助.

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.

或者,您也可以子类化" saveCell函数(请参见答案另一个(例如)).相应的代码可能如下所示

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

这篇关于拦截cellSubmit jqGrid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆