如何在jqgrid中exportToExcel计算列? exportToExcel虚拟列

问题描述:

下面的jsfiddle jqgrid中col3的excel导出不包含任何数据。如何在jqgrid中exportToExcel计算列? exportToExcel虚拟列

有谁知道如何获取数据到exportToExcel的虚拟或计算列?

​​

$("#grid").jqGrid({ 
datatype: "local", 
data: mydata, 
height: 250, 
width: 500, 
colNames: ['id', 'col1', 'col2', 'col3'], 
pager: "#gridpager", 
colModel: [{ 
     name: 'id', 
     index: 'id', 
     width: 60, 
    }, 
    { 
     name: 'col1', 
     index: 'col1', 
     width: 50, 
    }, 
    { 
     name: 'col2', 
     index: 'col2', 
     width: 50 
    }, 
    { 
     name: 'col3', 
     index: 'col3', 
     width: 50, 
     formatter: function(cellvalue, options, rowObject) { 
      var showValue = (parseInt(rowObject.col1) + parseInt(rowObject.col2)); 
      if (showValue) { 
       if (options.isExported) { 
        return showValue; 
       } else { 
        return showValue; 
       } 
      } else { 
       return 'novalue'; 
      } 
     }, 
    } 
], 
caption: "exportToExcel Calculated Column", 

});

原因是代码中存在一个错误。问题是fixed和固定代码可以从GitHub获得

+0

@carboncope,谢谢 - 很高兴帮助 –