Primary key values are used as row ids in json data returned from server. If primary key value is edited and saved two times, second save causes error since jqGrid passes original primary key value again to edit method.
How to update jqGrid row id to new primary key value if primary key value is changed in inline editing ?
$(function () {
var grid = $("#grid");
grid.jqGrid({
url: '<%= ResolveUrl("~/Grid/GetData?_entity=Strings")%>',
datatype: "json",
mtype: 'POST',
scroll: 1,
autoencode: true,
colModel: [{
name: 'Source',
fixed: true,
editable: true,
width: 30
}, { /* this is primary key passed also as id */
name: 'Est',
fixed: true,
editable: true,
width: 271
}, {
name: 'Eng',
fixed: true,
editable: true,
width: 167
}],
gridview: true,
pager: '#pager',
viewrecords: true,
editurl: '<%= ResolveUrl("~/Grid/Edit?_entity=Strings")%>',
...
The rowid is nothing more as the value of
id
attribute of the corresponding<tr>
element of the grid. So to change the rowidoldRowid
tonewRowid
you should do something like the following: