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 origin
#gridPreSeleccion = id grid
grid multiselect=true
function eliminarSeleccionados() {
var idsContribuyentesSelect = jQuery("#gridPreSeleccion").jqGrid('getGridParam', 'selarrrow');
if(idsContribuyentesSelect.length == 0) {
jQuery.MessageAlertSath("Es necesario seleccionar una fila.")
} else {
var ids = jQuery("#gridPreSeleccion").jqGrid('getDataIDs');
var a = ids.length;
var j = 0;
while(j == 0) {
if(jQuery("#gridPreSeleccion").jqGrid('getGridParam', 'selarrrow').length <= 0) {
j = 1;
} else {
for(var i = 0; i < a; i++) {
if(idsContribuyentesSelect[0] == ids[i]) {
jQuery('#gridPreSeleccion').delRowData(ids[i]);
break;
}
}
}
}
}
}
The rowid is nothing more as the value of id
attribute of the corresponding <tr>
element of the grid. So to change the rowid oldRowid
to newRowid
you should do something like the following:
$("#" + oldRowid).attr("id", newRowid);