Repository: ignite
Updated Branches:
  refs/heads/master 192678337 -> 1bb60ecd1


IGNITE-7306 Web Console: Fixed export data from tables.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1bb60ecd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1bb60ecd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1bb60ecd

Branch: refs/heads/master
Commit: 1bb60ecd190303b48f82e692ba32150a07b2cc5c
Parents: 1926783
Author: Dmitriy Shabalin <[email protected]>
Authored: Thu Jan 18 11:49:08 2018 +0700
Committer: Alexey Kuznetsov <[email protected]>
Committed: Thu Jan 18 11:49:08 2018 +0700

----------------------------------------------------------------------
 .../app/components/grid-export/component.js     | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/1bb60ecd/modules/web-console/frontend/app/components/grid-export/component.js
----------------------------------------------------------------------
diff --git 
a/modules/web-console/frontend/app/components/grid-export/component.js 
b/modules/web-console/frontend/app/components/grid-export/component.js
index 18e41c7..d312959 100644
--- a/modules/web-console/frontend/app/components/grid-export/component.js
+++ b/modules/web-console/frontend/app/components/grid-export/component.js
@@ -33,21 +33,31 @@ export default {
 
         export() {
             const data = [];
-            const columnHeaders = 
this.uiGridExporterService.getColumnHeaders(this.gridApi.grid, 
this.uiGridExporterConstants.VISIBLE);
+            const grid = this.gridApi.grid;
+            const exportColumnHeaders = 
this.uiGridExporterService.getColumnHeaders(grid, 
this.uiGridExporterConstants.VISIBLE);
 
-            _.forEach(this.gridApi.grid.rows, (row) => {
+            grid.rows.forEach((row) => {
                 if (!row.visible)
                     return;
 
                 const values = [];
-                _.forEach(columnHeaders, ({ name }) => {
-                    values.push({ value: row.entity[name] });
+
+                exportColumnHeaders.forEach((exportCol) => {
+                    const col = grid.columns.find(({ field }) => field === 
exportCol.name);
+
+                    if (!col || !col.visible || 
col.colDef.exporterSuppressExport === true)
+                        return;
+
+                    const value = grid.getCellValue(row, col);
+
+                    values.push({ value });
                 });
 
                 data.push(values);
             });
 
-            const csvContent = 
this.uiGridExporterService.formatAsCsv(columnHeaders, data, 
this.CSV.getSeparator());
+            const csvContent = 
this.uiGridExporterService.formatAsCsv(exportColumnHeaders, data, 
this.CSV.getSeparator());
+
             
this.uiGridExporterService.downloadFile(this.gridApi.grid.options.exporterCsvFilename,
 csvContent, this.gridApi.grid.options.exporterOlderExcelCompatibility);
         }
     },

Reply via email to