开发者

Using jqgrid. after swap first column(as rowid) and any other column then reload it, rowid automatically change to the value after swapped column

开发者 https://www.devze.com 2023-01-25 18:07 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消