在jqgrid格式化程序中使用其他列的cellvalue

时间:2016-03-18 08:03:29

标签: jquery jqgrid free-jqgrid

我可以在colModel的格式化键中使用其他列的单元格值。 所以基本上,我想改变cellvalue --> cellvalue of some other column

    colModel.push({
        'formatter': function(cellvalue, options, rowObject) {
            return '<a href="http://someLink/' + cellvalue + '">' + cellvalue + '</a>';
        }
    });

1 个答案:

答案 0 :(得分:2)

我们有两列name: "mycol1"name: "mycol2",您希望在第1列中添加自定义formatter,其中使用了URL中输入数据的属性mycol1锚点和属性mycol1作为锚点的文本。代码可能如下:

colModel.push({
    name: 'mycol1',
    formatter: function(cellvalue, options) {
        return '<a href="http://someLink/' + cellvalue + '">' +
                options.rowData.mycol2 + '</a>';
   }
});
相关问题