Search code examples
jqgrid

JqGrid reload grid after cell edit


I'm currently having a jqGrid with the possibility of editing a cell directly in the grid. It's not a inline edit because only the cell selected will change in edit mode. What I'd like is to reload the grid after the cell is changed. I know that with inline edit there is a way but can we do this with cell edit?

Here is my code:

$('#jqgCompLineCurrent').jqGrid({
        //url from wich data should be requested
        url: '@Url.Action("GetCompLine")',
        cellEdit: true,
        cellurl: '@Url.Action("UpdateCompProperty")',
        //type of data

Thanks in advance!


Solution

  • You can use afterSaveCell or afterSubmitCell to trigger grid reloading after successful cell saving. I think the code like the following should work:

    afterSaveCell: function () {
        $(this).trigger('reloadGrid');
    }
    

    If you are using latest version of free-jqGrid (4.15.5 or higher), you also need to set reloadingDuringEditing: 'save' at grid's properties.