Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
147295 | Sep 5,2019 11:50 AM UTC | Sep 9,2019 12:12 PM UTC | Angular - EJ 2 | 3 |
![]() |
Tags: Grid |
import { data, base64_Turkishfont } from './datasource';
@Component({
selector: 'app-root',
template: `<ejs-grid [dataSource]='data' [allowGrouping]='true' [allowPaging]='true'
[toolbar]='toolbar' (toolbarClick)='toolbarClick($event)'
[allowExcelExport]='true' [pageSettings]='pageSettings' [allowPdfExport]='true'>
<e-columns>
<e-column field='OrderID' headerText='รหัสคำสั่งซื้อ' textAlign='Right' width=90></e-column>
</e-columns>
</ejs-grid>`,
providers: [ToolbarService, PageService, ExcelExportService, PdfExportService]
})
export class AppComponent implements OnInit {
public gridData: Object[];
public toolbar: string[];
public pageSettings: Object;
@ViewChild('grid')
public grid: GridComponent;
. . . . .
toolbarClick(args: ClickEventArgs): void {
let id: any = document.getElementsByClassName('e-grid')[0].id + '_pdfexport';
let grid: any = (document.getElementsByClassName('e-grid')[0] as any).ej2_instances[0];
if (args.item.id === id) {
let pdfExportProperties: PdfExportProperties = {
theme: {
header: {font: new PdfTrueTypeFont(base64_Turkishfont, 12) },
caption: { font: new PdfTrueTypeFont(base64ThaiFont, 10) },
record: { font: new PdfTrueTypeFont(base64ThaiFont, 9) }
}
};
this.grid.pdfExport(pdfExportProperties);
}
}
}
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.