0

If form editing changes primary key, row id will not change.

Row ids are created from primary key. So after primary key editing in form row id becomes wrong.

Using reloadAfterSubmit: true, loses focus from added row so it should avoided. How to refresh jqgrid row id after primery key is changed by form editing without realoading whole grid ?

Form edit aftersubmit method returns correct changed row new id:

afterSubmit: function (response, postdata) { 
    var json = $.parseJSON(response.responseText),
    return [true, '', json.Id];
  }

However jqgrid does not change added row id to this. How to fix ?

Andrus
  • 26,339
  • 60
  • 204
  • 378

1 Answers1

0

If you get the primary key after editing, you can use jqgrid setCell method to change it.

here is the method link

you can search it with "setCell" in this page.

$('#gridTable').setCell(rowId, 'KeyColumnName', 'Value');
Jess Stone
  • 677
  • 8
  • 21
keep fool
  • 101
  • 4
  • jqgrid does this automatically: it refreshes all columns after editing including primary key columns. So this is not required. Probably I need to change row id: probably this is element id. For new row add usinfg form add we can return new row id in afterSubmit as descibed in Oleg answer to http://stackoverflow.com/questions/6954736/how-to-supply-a-row-id-when-using-jqgrid-editgridrow-to-create-a-new-row-and-n . However if new row id is returned after form editing as shown in code in question, jqgrid does not change row id. I asked how to change row id in this case – Andrus Aug 08 '12 at 16:25