-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathtree-grid-toolbar-sample-2.component.ts
More file actions
55 lines (48 loc) · 2.14 KB
/
Copy pathtree-grid-toolbar-sample-2.component.ts
File metadata and controls
55 lines (48 loc) · 2.14 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
import { Component } from '@angular/core';
import {
CsvFileTypes,
IColumnExportingEventArgs,
IgxCsvExporterOptions,
IgxExcelExporterOptions,
IgxExporterOptionsBase,
IGridToolbarExportEventArgs,
IgxCellTemplateDirective,
IgxColumnComponent,
IgxGridToolbarActionsComponent,
IgxGridToolbarComponent,
IgxGridToolbarExporterComponent,
IgxGridToolbarTitleComponent
} from 'igniteui-angular/grids/core';
import { IgxTreeGridComponent } from 'igniteui-angular/grids/tree-grid';
import { IgxAvatarComponent } from 'igniteui-angular/avatar';
import { EMPLOYEE_FLAT_AVATARS_DATA } from '../data/employees-flat-avatars';
import { IgxPreventDocumentScrollDirective } from '../../directives/prevent-scroll.directive';
@Component({
selector: 'app-tree-grid-toolbar-sample-2',
styleUrls: ['./tree-grid-toolbar-sample-2.component.scss'],
templateUrl: './tree-grid-toolbar-sample-2.component.html',
imports: [IgxTreeGridComponent, IgxPreventDocumentScrollDirective, IgxGridToolbarComponent, IgxGridToolbarTitleComponent, IgxGridToolbarActionsComponent, IgxGridToolbarExporterComponent, IgxColumnComponent, IgxCellTemplateDirective, IgxAvatarComponent]
})
export class TreeGridToolbarSample2Component {
public data: any[];
constructor() {
this.data = EMPLOYEE_FLAT_AVATARS_DATA();
}
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 field
columnArgs.cancel = columnArgs.header === 'Name';
});
}
}