The main problem is being able to select the row where you need the newline id. In most cases, the identifier will be generated by the database in which you save the data on the server. So, the first requirement for your server code is to return the identifier in a new line in the server response in the "add" operation.
For example, your server code returns the identifier of your string as a response to the add operation.
$("#list").jqGrid('navGrid', '#pager', {}, {}, {
reloadAfterSubmit: false,
afterSubmit: function (response) {
return [true, '', response.responseText];
},
addedrow: "last",
afterComplete: function (response, postdata) {
var gridId = this.gbox.substr(6);
$('#' + gridId).jqGrid('setSelection', postdata.id);
}
});
In the commented part, afterCompleteI showed how you can use jQuery UI highlight to highlight a newly added row (see the old answer ). This may be an alternative to row selection. You can also use highlight and highlight effects.
reloadAfterSubmit: false .
- (
sortname jqGrid ), . - (
rowNum), .
,
var idToSelect;
$("#list").jqGrid({
loadComplete: function () {
if (idToSelect) {
$(this).jqGrid('setSelection', idToSelect);
idToSelect = undefined;
}
}
}).jqGrid('navGrid', '#pager', {}, {}, {
afterSubmit: function (response) {
idToSelect = response.responseText;
return [true, '', response.responseText];
}
});
, .