如何在不重新加载的情况下在表单编辑中更改主键后刷新jqgrid行ID [英] how to refresh jqgrid row id after primary key is changed in form edit without reload
问题描述
如果表单编辑更改了主键,则行ID不会更改.
行ID是从主键创建的. 因此,在表单中对主键进行编辑后,行ID就会出错.
使用reloadAfterSubmit:true,由于添加的行失去了焦点,因此应避免使用. 在不重新加载整个网格的情况下,如何通过表单编辑更改入门键后刷新jqgrid行ID?
表单编辑后提交方法返回正确的更改行新ID:
afterSubmit: function (response, postdata) {
var json = $.parseJSON(response.responseText),
return [true, '', json.Id];
}
但是jqgrid不会更改为此添加的行ID. 如何解决?
如果在编辑后获得主键,则可以使用jqgrid setCell方法对其进行更改.
这是方法链接
您可以在此页面中使用"setCell"进行搜索.
$('#gridTable').setCell(rowId, 'KeyColumnName', 'Value');
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 ?
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');
这篇关于如何在不重新加载的情况下在表单编辑中更改主键后刷新jqgrid行ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!