我正在使用 Ignite UI。因为我使用的是 Igx 网格,所以我可以使用 导出所有数据的 excel IgxExcelExporterService
,但我想使用onRowSelectionChange
的方法仅导出选定的数据igx grid
。有没有办法igx-grid
支持这个功能?
问问题
157 次
1 回答
1
您可以使用 Excel Exporter 服务:
this.excelExportService。
exportData
(this.data,..)。
继续并将 a 传递data array
给服务。如何用选定的行数据填充数据数组?在这里,您可以找到用于引导您的 POC 的代码片段:
实际代码:
public clicked() {
let selectedRows = this.grid1.selectedRows;
for (let rowIndex of selectedRows) {
let rowData = this.grid1.getRowByIndex(rowIndex).rowData;
this.exportData.push(rowData);
}
console.log(this.exportData);
this.excelExportService.exportData(this.exportData,
new IgxExcelExporterOptions("ExportedDataFile"));
this.exportData = [];
}
这个导出 excel 主题将进一步帮助您。
将此作为igxGrid 行选择的起点。
于 2021-01-25T19:05:16.117 回答