Intercept the cellSubmit jqGrid
Asked Answered
S

1

1

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.

Swithin answered 12/9, 2012 at 22:56 Comment(0)
T
2

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;
    }
});
Tiki answered 13/9, 2012 at 6:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.