Using jqgrid. after swap first column(as rowid) and any other column then reload it, rowid automatically change to the value after swapped column
Such as the title
I need to add some details after load from json data format, however After I swap the two columns ( one is first column which used as rowid ), 'checkId' is no longer the rowid. In setRowData method, if each row of the swapped column' values are same, it can not identify each row.
I just a beginner of jqgrid, did I miss something?
jqgrid like this:
colModel:[
{name:'checkId',index:'checkId', width:80, key:true},
{name:'mobjName',index:'mobjName'},
{name:'sabilityName',index:'sabilityName'},
...
gridComplete: funct开发者_开发知识库ion(){
var _ids = jQuery("#my_grid").jqGrid('getDataIDs');
$(_ids).each(function(i, n) {
var row = jQuery("#my_grid").jqGrid('getRowData', n);
var _optcolstr = ...
...do something.
jQuery("#my_grid").jqGrid('setRowData', n, {optcol: _optcolstr});
});
Correspond to the documentation the syntax of the usage of setRowData
should be following:
jQuery("#my_grid").jqGrid('setRowData', n, row , {optcol: _optcolstr});
or
jQuery("#my_grid").jqGrid('setRowData', n, false, {optcol: _optcolstr});
if you don't want modify the row data and only change some css property with the name optcol
.
精彩评论