2016-03-18 51 views
0

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

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

回答

2

让我们你有两列name: "mycol1"name: "mycol2",你想在第1列,其使用的输入数据的属性mycol1在锚的URL定制formatter添加和文本的属性mycol1锚点。代码可能如下:

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