how to refresh jqgrid row id after primary key is changed in form edit without reload
Asked Answered
V

1

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 ?

Vertebral answered 6/8, 2012 at 12:52 Comment(0)
J
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');
Jewelfish answered 8/8, 2012 at 6:21 Comment(1)
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 <tr> element id. For new row add usinfg form add we can return new row id in afterSubmit as descibed in Oleg answer to #6955236 . 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 caseVertebral

© 2022 - 2024 — McMap. All rights reserved.