In the answer I suggested to extend addRowData method to support new 'afterSelected' and 'beforeSelected' values (additionally to existing 'first', 'last', 'before' and 'after') of the position parameter. I shown one can overwrite (subclass) the original addRowData method to add the support without writing the full code of addRowData.
In the corresponding demo I demonstrated how one could use the feature in case of the usage of form editing.
In the same way we can solve the problem in the inlineNav method too. The new demo demonstrate this.
The corresponding code is practically the copy of the codes from the answer.
var oldAddRowData = $.fn.jqGrid.addRowData;
$.jgrid.extend({
addRowData: function (rowid, rdata, pos, src) {
if (pos === 'afterSelected' || pos === 'beforeSelected') {
if (typeof src === 'undefined' && this[0].p.selrow !== null) {
src = this[0].p.selrow;
pos = (pos === "afterSelected") ? 'after' : 'before';
} else {
pos = (pos === "afterSelected") ? 'last' : 'first';
}
}
return oldAddRowData.call(this, rowid, rdata, pos, src);
}
});
...
$("#list").jqGrid('inlineNav', '#pager', {addParams: {position: "afterSelected"}});
Probably I should post to trirand the corresponding suggestion to modify the original addRowData method with the described above features.