我想向从angular-ui-grid导出的csv文件添加标题行,该文件显示有关数据的一些附加信息(例如标题和选定的过滤器)。这可能吗?
我目前的实施包括以下选项。它使用exporterHeaderFilter
函数为每个列标题添加了过滤条件,但我也进行了全局搜索,因此我希望将其包含在顶部:
$scope.gridOptions = {
data: 'projects',
columnDefs: $scope.gridColumns,
enableFiltering: true,
enableGridMenu: true,
exporterMenuPdf: false,
exporterCsvColumnSeparator: ';',
exporterHeaderFilterUseName: true,
exporterHeaderFilter: function (name) {
// I would like to do something similar to this,
// but instead of modifying each column header,
// I want to have a general header above all columns
var column = grid.getColumn(name);
var header = column.displayName;
// add filter term to the column header
column.filters.forEach(function (filter) {
if (!!filter.term) {
header += ' (Filter: ' + filter.term + ')';
}
});
return header;
},
// ...
}
结果应如下所示:
"Projekte (Filter: Lorem)"
"Nr.";"Name";"Jahr"
"49";"Projekt Lorem Ipsum";"2018"