Skip to content

Commit b98433f

Browse files
committed
Fix(exporter): fix #3332 again, data out of order
1 parent 5265115 commit b98433f

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

src/features/exporter/js/exporter.js

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -658,15 +658,15 @@
658658
*/
659659
getColumnHeaders: function (grid, colTypes) {
660660
var headers = [];
661-
var sourceColumns;
661+
var columns;
662662

663663
if ( colTypes === uiGridExporterConstants.ALL ){
664-
sourceColumns = grid.columns;
664+
columns = grid.columns;
665665
} else {
666-
sourceColumns = grid.renderContainers.body.visibleColumnCache.filter( function( column ){ return column.visible; } );
666+
columns = grid.renderContainers.body.visibleColumnCache.filter( function( column ){ return column.visible; } );
667667
}
668668

669-
sourceColumns.forEach( function( gridCol, index ) {
669+
columns.forEach( function( gridCol, index ) {
670670
if ( gridCol.colDef.exporterSuppressExport !== true &&
671671
grid.options.exporterSuppressColumns.indexOf( gridCol.name ) === -1 ){
672672
headers.push({
@@ -723,9 +723,9 @@
723723
*/
724724
getData: function (grid, rowTypes, colTypes) {
725725
var data = [];
726-
727726
var rows;
728-
727+
var columns;
728+
729729
switch ( rowTypes ) {
730730
case uiGridExporterConstants.ALL:
731731
rows = grid.rows;
@@ -741,12 +741,20 @@
741741
}
742742
break;
743743
}
744-
744+
745+
if ( colTypes === uiGridExporterConstants.ALL ){
746+
columns = grid.columns;
747+
} else {
748+
columns = grid.renderContainers.body.visibleColumnCache.filter( function( column ){ return column.visible; } );
749+
}
750+
745751
rows.forEach( function( row, index ) {
746752

747753
if (row.exporterEnableExporting !== false) {
748754
var extractedRow = [];
749-
grid.columns.forEach( function( gridCol, index ) {
755+
756+
757+
columns.forEach( function( gridCol, index ) {
750758
if ( (gridCol.visible || colTypes === uiGridExporterConstants.ALL ) &&
751759
gridCol.colDef.exporterSuppressExport !== true &&
752760
grid.options.exporterSuppressColumns.indexOf( gridCol.name ) === -1 ){
@@ -757,11 +765,11 @@
757765
extractedRow.push(extractedField);
758766
}
759767
});
760-
768+
761769
data.push(extractedRow);
762770
}
763771
});
764-
772+
765773
return data;
766774
},
767775

0 commit comments

Comments
 (0)