File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
projects/igniteui-angular/src/lib/services/csv Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 11import { ExportUtilities } from '../exporter-common/export-utilities' ;
22import { yieldingLoop } from '../../core/utils' ;
3- import { IColumnInfo } from '../exporter-common/base-export-service' ;
3+ import { ExportHeaderType , IColumnInfo } from '../exporter-common/base-export-service' ;
44
55/**
66 * @hidden
@@ -43,7 +43,8 @@ export class CharSeparatedValueData {
4343 }
4444
4545 public prepareDataAsync ( done : ( result : string ) => void ) {
46- const columns = this . columns ?. filter ( c => ! c . skip )
46+ const columns = this . columns ?. filter ( c => c . headerType !== ExportHeaderType . MultiColumnHeader )
47+ . filter ( c => ! c . skip )
4748 . sort ( ( a , b ) => a . startIndex - b . startIndex )
4849 . sort ( ( a , b ) => a . pinnedIndex - b . pinnedIndex ) ;
4950 const keys = columns && columns . length ? columns . map ( c => c . field ) : ExportUtilities . getKeysFromData ( this . _data ) ;
@@ -52,7 +53,10 @@ export class CharSeparatedValueData {
5253 this . _escapeCharacters . push ( this . _delimiter ) ;
5354
5455 const headers = columns && columns . length ?
55- columns . map ( c => c . header ?? c . field ) :
56+ /* When column groups are present, always use the field as it indicates the group the column belongs to.
57+ * Otherwise, in PivotGrid scenarios we can end up with many duplicated columns.
58+ */
59+ columns . map ( c => c . columnGroupParent ? c . field : c . header ?? c . field ) :
5660 keys ;
5761
5862 this . _headerRecord = this . processHeaderRecord ( headers , this . _data . length ) ;
You can’t perform that action at this time.
0 commit comments