Skip to content

Commit d42944c

Browse files
Merge pull request #2469 from IgniteUI/ibarakov/fix-excel-export-sample
rework excel export sample
2 parents 991cf08 + bc704dd commit d42944c

File tree

5 files changed

+22
-13
lines changed

5 files changed

+22
-13
lines changed

src/app/services/export-csv/csv-export-sample-1/csv-export-sample-1.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ export class CsvExportSample1Component {
3131
args.cancel = true;
3232
}
3333
});
34-
this.csvExportService.onRowExport.subscribe((args: IRowExportingEventArgs) => {
34+
this.csvExportService.rowExporting.subscribe((args: IRowExportingEventArgs) => {
3535
});
36-
this.csvExportService.onExportEnded.subscribe((args: ICsvExportEndedEventArgs) => {
36+
this.csvExportService.exportEnded.subscribe((args: ICsvExportEndedEventArgs) => {
3737
});
3838
*/
3939
this.csvExportService.export(this.igxGrid1, new IgxCsvExporterOptions("ExportFileFromGrid", CsvFileTypes.CSV));

src/app/services/export-csv/csv-export-tree-grid-sample/csv-export-tree-grid-sample.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ export class TreeGridCsvExportSample1Component implements OnInit {
3535
args.cancel = true;
3636
}
3737
});
38-
this.csvExportService.onRowExport.subscribe((args: IRowExportingEventArgs) => {
38+
this.csvExportService.rowExporting.subscribe((args: IRowExportingEventArgs) => {
3939
});
40-
this.csvExportService.onExportEnded.subscribe((args: ICsvExportEndedEventArgs) => {
40+
this.csvExportService.exportEnded.subscribe((args: ICsvExportEndedEventArgs) => {
4141
});
4242
*/
4343
this.csvExportService.export(this.igxTreeGrid1,

src/app/services/export-excel/excel-export-sample-1/excel-export-sample-1.component.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<p class="grid__wrapper">
2-
<igx-grid #igxGrid1 [data]="data" [allowFiltering]="true" [cellSelection]="'single'" [width]="'1200px'"
3-
[hideGroupedColumns]="true" [height]="'700px'">
2+
<igx-grid #igxGrid1 [data]="data" [groupingExpressions]='groupExpressions' [allowFiltering]="true" [cellSelection]="'single'"
3+
[hideGroupedColumns]="true" [width]="'100%'" [height]="'700px'">
44
<igx-column *ngFor="let c of columns" [sortable]="true" [field]="c.field" [header]="c.field" [width]="c.width"
55
[hidden]='c.hidden' [groupable]='c.groupable' [movable]='true' [editable]="true" [dataType]='c.dataType'>
66
</igx-column>

src/app/services/export-excel/excel-export-sample-1/excel-export-sample-1.component.ts

+14-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import { Component, OnInit, ViewChild } from "@angular/core";
2-
import { IgxExcelExporterOptions,
3-
IgxExcelExporterService,
4-
IgxGridComponent } from "igniteui-angular";
2+
import {
3+
IgxExcelExporterOptions,
4+
IgxExcelExporterService,
5+
IgxGridComponent,
6+
ISortingExpression,
7+
SortingDirection
8+
} from "igniteui-angular";
59
import { INVOICE_DATA } from "../data/invoiceData";
610

711
@Component({
@@ -13,6 +17,7 @@ export class ExcelExportSample1Component implements OnInit {
1317
@ViewChild("igxGrid1", { static: true }) public igxGrid1: IgxGridComponent;
1418

1519
public data = [];
20+
public groupExpressions : ISortingExpression[];
1621
public columns = [
1722
{ dataType: 'string', field: 'ShipCountry', width: 150, groupable: true },
1823
{ dataType: 'string', field: 'ShipCity', width: 150, groupable: true },
@@ -27,6 +32,10 @@ export class ExcelExportSample1Component implements OnInit {
2732

2833
public ngOnInit(): void {
2934
this.data = INVOICE_DATA;
35+
this.groupExpressions = [
36+
{ dir: SortingDirection.Asc, fieldName: "ShipCountry" },
37+
{ dir: SortingDirection.Asc, fieldName: "ShipCity" }
38+
];
3039
}
3140

3241
public exportButtonHandler() {
@@ -38,9 +47,9 @@ export class ExcelExportSample1Component implements OnInit {
3847
args.cancel = true;
3948
}
4049
});
41-
this.excelExportService.onRowExport.subscribe((args: IRowExportingEventArgs) => {
50+
this.excelExportService.rowExporting.subscribe((args: IRowExportingEventArgs) => {
4251
});
43-
this.excelExportService.onExportEnded.subscribe((args: IExcelExportEndedEventArgs) => {
52+
this.excelExportService.exportEnded.subscribe((args: IExcelExportEndedEventArgs) => {
4453
});
4554
*/
4655
this.excelExportService.export(this.igxGrid1, new IgxExcelExporterOptions("ExportFileFromGrid"));

src/app/services/export-excel/excel-export-tree-grid-sample/excel-export-tree-grid-sample.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ export class TreeGridExcelExportSample1Component implements OnInit {
3434
args.cancel = true;
3535
}
3636
});
37-
this.excelExportService.onRowExport.subscribe((args: IRowExportingEventArgs) => {
37+
this.excelExportService.rowExporting.subscribe((args: IRowExportingEventArgs) => {
3838
});
39-
this.excelExportService.onExportEnded.subscribe((args: IExcelExportEndedEventArgs) => {
39+
this.excelExportService.exportEnded.subscribe((args: IExcelExportEndedEventArgs) => {
4040
});
4141
*/
4242
this.excelExportService.export(this.igxTreeGrid1,

0 commit comments

Comments
 (0)