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).