1
1
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" ;
5
9
import { INVOICE_DATA } from "../data/invoiceData" ;
6
10
7
11
@Component ( {
@@ -13,6 +17,7 @@ export class ExcelExportSample1Component implements OnInit {
13
17
@ViewChild ( "igxGrid1" , { static : true } ) public igxGrid1 : IgxGridComponent ;
14
18
15
19
public data = [ ] ;
20
+ public groupExpressions : ISortingExpression [ ] ;
16
21
public columns = [
17
22
{ dataType : 'string' , field : 'ShipCountry' , width : 150 , groupable : true } ,
18
23
{ dataType : 'string' , field : 'ShipCity' , width : 150 , groupable : true } ,
@@ -27,6 +32,10 @@ export class ExcelExportSample1Component implements OnInit {
27
32
28
33
public ngOnInit ( ) : void {
29
34
this . data = INVOICE_DATA ;
35
+ this . groupExpressions = [
36
+ { dir : SortingDirection . Asc , fieldName : "ShipCountry" } ,
37
+ { dir : SortingDirection . Asc , fieldName : "ShipCity" }
38
+ ] ;
30
39
}
31
40
32
41
public exportButtonHandler ( ) {
@@ -38,9 +47,9 @@ export class ExcelExportSample1Component implements OnInit {
38
47
args.cancel = true;
39
48
}
40
49
});
41
- this.excelExportService.onRowExport .subscribe((args: IRowExportingEventArgs) => {
50
+ this.excelExportService.rowExporting .subscribe((args: IRowExportingEventArgs) => {
42
51
});
43
- this.excelExportService.onExportEnded .subscribe((args: IExcelExportEndedEventArgs) => {
52
+ this.excelExportService.exportEnded .subscribe((args: IExcelExportEndedEventArgs) => {
44
53
});
45
54
*/
46
55
this . excelExportService . export ( this . igxGrid1 , new IgxExcelExporterOptions ( "ExportFileFromGrid" ) ) ;
0 commit comments