dongxing8009 2018-08-10 07:13
浏览 299

在jqgrid中,rowobject值在第一页中未定义,rowObject值在下一页中返回

In jqgrid-4.8 I am getting rowObject value as undefined in first page and receiving values in next pages if I used rowObject.name. if I used rowObject[0] then rowObject values as getting from cells in first page but not in subsequent pages. plz help to solve this issue.

 {name:'snp',index:'snp', width:100, align:"center"},
 {name:'chr',index:'chr', width:100, align:"center"},
 {name:'pos',index:'pos', width:100, align:"center"},
 {name:'calls',index:'calls',width:120,align:"center",sortable:false,formatter:function(cellvalue, options, rowObject){ return '<a href="http://localhost/var/sub1.php?id='+rowObject.snp+'&chr='+rowObject.chr+'&pos='+rowObject.pos+'" target="_blank"><font color="0000FF">view</a>';} }

If I use rowObject[0] & rowObject[1] is also not fully functional, it is functional in first page, not is next pages. it is showing cell values as undefined

  • 写回答

1条回答 默认 最新

  • 普通网友 2018-08-12 17:43
    关注

    The problem, which you described is old known. Old version of jqGrid makes difficult to write custom formatter where you have to access data from another column if you use array of items as input data. Simple trick described in the old answer allows to write the corresponding code. Instead of $.isArray one should better use Array.isArray method.

    If you use free jqGrid then you can solve the problem more easier. I don't changed the format of the 3-d parameter (rowObject) of custom formatter, but I added rowData property to options option with named data. Thus you can use the following code in free jqGrid:

    formatter: function (cellvalue, options) {
        var item = options.rowData;
        return '<a href="http://localhost/var/sub1.php?id=' + 
            item.snp + '&chr=' + item.chr + '&pos=' + item.pos +
            '" target="_blank"><font color="0000FF">view</a>';
    }
    

    Additionally I would strictly recommend you to use current version of free jqGrid (4.15.4 or probably 4.15.5) instead of retro version 4.8, which is not more supported.

    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!