2016-03-18 57 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>'; 
    } 
}); 
相關問題