Angularjs 在角度ui网格中,如何在导出为pdf时包含页脚行
我在我的项目中使用ui网格,其中添加了一个roe聚合平均值行,该行反映网格中该列值的平均值。现在我已经实现了导出为PDF选项,但是导出网格时不包括反映平均值的页脚行。我调查并尝试了上述内容:Angularjs 在角度ui网格中,如何在导出为pdf时包含页脚行,angularjs,angular-ui-grid,Angularjs,Angular Ui Grid,我在我的项目中使用ui网格,其中添加了一个roe聚合平均值行,该行反映网格中该列值的平均值。现在我已经实现了导出为PDF选项,但是导出网格时不包括反映平均值的页脚行。我调查并尝试了上述内容: gridOptions.exporterPdfCustomFormatter = function ( docDefinition ) { docDefinition.styles.footerStyle = { bold: true, fontSize: 10 }; return docDefin
gridOptions.exporterPdfCustomFormatter = function ( docDefinition ) {
docDefinition.styles.footerStyle = { bold: true, fontSize: 10 };
return docDefinition;
}
gridOptions.exporterPdfFooter = { text: 'My footer', style: 'footerStyle' }
或
或
似乎这些选项不起作用,或者我做错了。有什么建议吗?这里有一种方法我能找到答案 创建页脚方法
$scope.getFooterValue = function(i){
return $scope.gridApi.grid.columns[i].getAggregationValue();
}
然后在单击“打印pdf”btn时为页脚创建一个表
$scope.$on('print', function(event, filter) {
$scope.gridOptions.exporterPdfFooter = {
table: {
widths: [ '*'],
body: [
[ 'Totals: '],
]
}
};
$scope.export();
}
您没有在gridOptions中使用$scope.$scope.GetFooter值,或者在进行导出()时没有使用$scope.GetFooter值,对吗?那么这将如何使用呢?另外,如果i是列数,如果这是一个动态网格,您可能需要在多个列中获取聚合值,那么如何传递到函数中?
$scope.getFooterValue = function(i){
return $scope.gridApi.grid.columns[i].getAggregationValue();
}
$scope.$on('print', function(event, filter) {
$scope.gridOptions.exporterPdfFooter = {
table: {
widths: [ '*'],
body: [
[ 'Totals: '],
]
}
};
$scope.export();
}