-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathgrid-toolbar-sample-3.component.ts
More file actions
56 lines (49 loc) · 2.12 KB
/
Copy pathgrid-toolbar-sample-3.component.ts
File metadata and controls
56 lines (49 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import { Component } from '@angular/core';
import {
CsvFileTypes,
IColumnExportingEventArgs,
IgxCsvExporterOptions,
IgxExcelExporterOptions,
IgxExporterOptionsBase,
IGridToolbarExportEventArgs,
IgxCellTemplateDirective,
IgxColumnComponent,
IgxGridToolbarActionsComponent,
IgxGridToolbarComponent,
IgxGridToolbarExporterComponent,
IgxGridToolbarTitleComponent
} from 'igniteui-angular/grids/core';
import { IgxGridComponent } from 'igniteui-angular/grids/grid';
import { IgxAvatarComponent } from 'igniteui-angular/avatar';
import { athletesData } from '../../data/athletesData';
import { IgxPreventDocumentScrollDirective } from '../../directives/prevent-scroll.directive';
@Component({
selector: 'app-grid-toolbar-sample-3',
styleUrls: ['./grid-toolbar-sample-3.component.scss'],
templateUrl: './grid-toolbar-sample-3.component.html',
imports: [IgxGridComponent, IgxPreventDocumentScrollDirective, IgxGridToolbarComponent, IgxGridToolbarTitleComponent, IgxGridToolbarActionsComponent, IgxGridToolbarExporterComponent, IgxColumnComponent, IgxCellTemplateDirective, IgxAvatarComponent]
})
export class GridToolbarSample3Component {
public data: any[];
constructor() {
this.data = athletesData;
}
public configureExport(args: IGridToolbarExportEventArgs) {
// You can customize the exporting from this event
const options: IgxExporterOptionsBase = args.options;
options.fileName = `Report_${new Date().toDateString()}`;
if (options instanceof IgxExcelExporterOptions) {
const excelOptions = options as IgxExcelExporterOptions;
excelOptions.columnWidth = 10;
} else {
const csvOptions = options as IgxCsvExporterOptions;
csvOptions.fileType = CsvFileTypes.TSV;
csvOptions.valueDelimiter = '\t';
}
args.exporter.columnExporting.subscribe((columnArgs: IColumnExportingEventArgs) => {
// Don't export image fields
columnArgs.cancel = columnArgs.header === 'Athlete' ||
columnArgs.header === 'Country';
});
}
}