Commit ff6ec3e7 by Nakarin Luankla

Merge branch 'DEV' of https://mygit.myhr.co.th/angular/myAppraisal into DEV

parents a92c099d af6a12a8
...@@ -8,14 +8,14 @@ ...@@ -8,14 +8,14 @@
[allowMultiSorting]='true'> [allowMultiSorting]='true'>
<e-columns> <e-columns>
<e-column [textAlign]="'center'" *ngIf="checkBoxSetting" [allowEditing]="false"> <e-column headerText='checkboxSelect' [textAlign]="'center'" width='150' *ngIf="checkBoxSetting">
<ng-template #headerTemplate let-data> <ng-template #headerTemplate let-data *ngIf="checkBoxSetting">
<input type="checkbox" [id]="'checkbox-all'" class="ti-form-checkbox cursor-pointer" <input type="checkbox" [id]="'checkbox-all'" class="ti-form-checkbox cursor-pointer"
[checked]="selectedItemsAll" (click)="toggleSelectionAll()"> [checked]="selectedItemsAll" (click)="toggleSelectionAll()">
<label [for]="'checkbox-all'" class="font-size-12px font-weight-700 text-primary"> <label [for]="'checkbox-all'" class="font-size-12px font-weight-700 text-primary">
&nbsp;{{selectedItems.count}} Selected</label> &nbsp;{{selectedItems.count}} Selected</label>
</ng-template> </ng-template>
<ng-template #template let-data> <ng-template #template let-data *ngIf="checkBoxSetting">
<input type="checkbox" class="ti-form-checkbox cursor-pointer" <input type="checkbox" class="ti-form-checkbox cursor-pointer"
[checked]="selectedItems.data.get(data[selectedItems.key]) || false" [checked]="selectedItems.data.get(data[selectedItems.key]) || false"
(click)="toggleSelection(data[selectedItems.key], !selectedItems.data.get(data[selectedItems.key]))"> (click)="toggleSelection(data[selectedItems.key], !selectedItems.data.get(data[selectedItems.key]))">
...@@ -30,10 +30,10 @@ ...@@ -30,10 +30,10 @@
</ng-template> </ng-template>
</e-column> </e-column>
<e-column headerText='action' width='150' textAlign='Center' *ngIf="actionSetting"> <e-column headerText='action' width='150' textAlign='Center' *ngIf="actionSetting">
<ng-template #headerTemplate let-data> <ng-template #headerTemplate let-data *ngIf="actionSetting">
<span class="font-size-12px font-weight-700 text-primary">การจัดการ</span> <span class="font-size-12px font-weight-700 text-primary">การจัดการ</span>
</ng-template> </ng-template>
<ng-template #template let-data> <ng-template #template let-data *ngIf="actionSetting">
<i class="ti ti-eye cursor-pointer i-gray fs-l px-1" (click)="onNextPage(data)" *ngIf="canChild"></i> <i class="ti ti-eye cursor-pointer i-gray fs-l px-1" (click)="onNextPage(data)" *ngIf="canChild"></i>
<i class="ti ti-edit cursor-pointer i-gray fs-l px-1" [attr.data-hs-overlay]="modalName" *ngIf="canEdit" <i class="ti ti-edit cursor-pointer i-gray fs-l px-1" [attr.data-hs-overlay]="modalName" *ngIf="canEdit"
(click)="onSelectData(data)"></i> (click)="onSelectData(data)"></i>
......
...@@ -6,7 +6,8 @@ import { ...@@ -6,7 +6,8 @@ import {
ViewEncapsulation, ViewEncapsulation,
OnInit, OnInit,
ViewChild, ViewChild,
SimpleChanges SimpleChanges,
ChangeDetectorRef
} from '@angular/core'; } from '@angular/core';
import { import {
EditService, EditService,
...@@ -28,7 +29,9 @@ import { ...@@ -28,7 +29,9 @@ import {
Grid, Grid,
AggregateService, AggregateService,
PdfExportProperties, PdfExportProperties,
LoadingIndicatorModel LoadingIndicatorModel,
ExcelExportProperties,
Column
} from '@syncfusion/ej2-angular-grids'; } from '@syncfusion/ej2-angular-grids';
import { GroupSettingsModel, FilterSettingsModel, ColumnModel } from '@syncfusion/ej2-angular-grids'; import { GroupSettingsModel, FilterSettingsModel, ColumnModel } from '@syncfusion/ej2-angular-grids';
import { DataManager, Query } from '@syncfusion/ej2-data'; import { DataManager, Query } from '@syncfusion/ej2-data';
...@@ -121,7 +124,8 @@ export class DatagridSyncfutionComponent implements OnInit { ...@@ -121,7 +124,8 @@ export class DatagridSyncfutionComponent implements OnInit {
// @Output() pageChanged = new EventEmitter<number>(); // @Output() pageChanged = new EventEmitter<number>();
// @Output() filterChanged = new EventEmitter<FilterEventArgs>(); // @Output() filterChanged = new EventEmitter<FilterEventArgs>();
// ... // ...
constructor(private cdr: ChangeDetectorRef) {
}
ngOnInit(): void { ngOnInit(): void {
// this.query = new Query().addParams('dataCount', '1000'); // this.query = new Query().addParams('dataCount', '1000');
this.loadingIndicator = { indicatorType: 'Shimmer' }; this.loadingIndicator = { indicatorType: 'Shimmer' };
...@@ -151,10 +155,30 @@ export class DatagridSyncfutionComponent implements OnInit { ...@@ -151,10 +155,30 @@ export class DatagridSyncfutionComponent implements OnInit {
toolbarClick(args: any): void { toolbarClick(args: any): void {
if (args.item.id === 'Grid_excelexport') { if (args.item.id === 'Grid_excelexport') {
this.grid?.excelExport(); let exportProperties: ExcelExportProperties = {
} columns: this.columns.map(col => ({
else if (args.item.id === 'Grid_csvexport') { field: col.field,
this.grid?.csvExport(); headerText: col.headerText
})) as Column[]
};
this.grid?.excelExport(exportProperties);
} else if (args.item.id === 'Grid_csvexport') {
let exportColumns = this.columns.map(col => ({
field: col.field!,
headerText: col.headerText!
}));
this.grid?.csvExport({ columns: exportColumns as Column[] });
} else if (args.item.id === 'Grid_print') {
const checkBoxSetting = this.checkBoxSetting
this.checkBoxSetting = false
const actionSetting = this.actionSetting
this.actionSetting = false
this.cdr.detectChanges()
setTimeout(() => {
this.checkBoxSetting = checkBoxSetting
this.actionSetting = actionSetting
this.cdr.detectChanges()
}, 1000)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment