0

I want to do some action after inline edit but when I use this code, after edit the row just stuck in edit mode. If I delete onSelectRow, row edit works perfectly.

onSelectRow: function(rowid){

    $(grid_selector).jqGrid('editRow', rowid, true, null, null, null, {}, aftersavefunc);

    function aftersavefunc(rowid, result) {
        alert("X"); 
        $(grid_selector).trigger("reloadGrid");
    }
},
2
  • Do you get the alert("X"); popup continuously while it's stuck in edit mode?
    – Brandon
    Aug 29, 2014 at 13:40
  • no I don't get any alert.
    – Mert
    Aug 29, 2014 at 13:47

1 Answer 1

0

First of all you wrote:

If I delete onSelectRow, row edit works perfectly.

It sound suspected because you start row editing inside of editRow. If inline editing still work after you delete onSelectRow callback then you should search for other part of your code where editRow will be called directly of indirectly. For example you could use formatter: "actions" or inlineNav which starts editRow for you. To inform jqGrid to use your aftersavefunc you have to use corresponding parameters of inlineNav or formatter: "actions". For example inlineNav provide editParams and addParams options. Typically one defines one set op inline editing parameters (see editOptions variable in the code below) and one uses it in both direct and indirect call of editRow:

var editOptions = {
        keys: true,
        successfunc: function () {
            var $self = $(this);
            setTimeout(function () {
                $self.trigger("reloadGrid");
            }, 50);
        }
    },
    $grid = $("#list");

$grid.jqGrid({
    ...
    onSelectRow: function (rowid) {
        $(thus).jqGrid("editRow", rowid, editOptions);
    }
});

$grid.jqGrid("navGrid", "#pager", { edit: false, add: false });

$grid.jqGrid("inlineNav", "#pager", {
    addParams: {
        position: "last",
        addRowParams: editOptions
    },
    editParams: editOptions
});

By the way one can click original Edit button added by inlineNav instead of calling editRow directly. See the answer for the corresponding code example (inside of onSelectRow callback).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.