Although that's an old question, I'd like to add an example of explicitly calling editRow
and then saveRow
, which is a pretty frequent case.
The following code allows the user to just move freely between selected rows, and save the previous selected, edited row:
var grid = $('#gridName').jqGrid({
// ... some grid properties ...
editurl: 'clientArray',
cellEdit: false, // that's the default, but just to make clear that wer'e in inline edit mode
onSelectRow: utils.onSelectRow
// ... some more grid properties ...
});
var utils = {
prevRowId: null, // we have to keep the previous row id
onSelectRow: function (rowId, selectionStatus, event) {
if (rowId && rowId !== utils.prevRowId) {
var $grid = $(event.target).closest('table');
$grid.jqGrid('saveRow', utils.prevRowId);
$grid.jqGrid('editRow', rowId, { keys: true });
utils.prevRowId = rowId;
}
},
};
I couldn't find one of Oleg's official examples doing exactly this (they're all using buttons, as this one, or calling retrieveRow
instead of saveRow
, as this one).