Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
144061 | Apr 16,2019 12:43 PM UTC | Apr 17,2019 07:18 AM UTC | Angular - EJ 2 | 4 |
![]() |
Tags: Grid |
[app.component.html]
<button ejs-button (click)="btnClicked()">ExcelExport</button>
<ejs-grid #grid [dataSource]='data' allowPaging='true'
[allowExcelExport]='true'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' width='120' textAlign='Right' isPrimaryKey='true'></e-column>
<e-column field='OrderDate' headerText='Order Date' width='130' format="yMd" textAlign='Right'></e-column>
<e-column field='CustomerID' headerText='Customer ID' width='120'></e-column>
<e-column field='Freight' headerText='Freight' [allowGrouping]="false" width='120' format='C2' textAlign='Right'></e-column>
<e-column field='ShipCountry' headerText='Ship Country' width='150'></e-column>
</e-columns>
</ejs-grid>
-------------------------------------------------------------------------------------------------------------------------
[app.component.ts]
export class AppComponent {
public data: Object[];
@ViewChild('grid')
public grid: GridComponent;
public ngOnInit(): void {
this.data = orderDetails;
}
btnClicked(args): void {
this.grid.excelExport();
}
}
|
[app.component.html]
<img src="https://upload.wikimedia.org/wikipedia/commons/f/f9/Phoenicopterus_ruber_in_S%C3%A3o_Paulo_Zoo.jpg" style="width: 50px;
height: 50px;" (click)="btnClicked()">
<ejs-grid #grid [dataSource]='data' allowPaging='true'
[allowExcelExport]='true'>
<e-columns>
-----
</e-columns>
</ejs-grid>
---------------------------------------------------------------------------
[app.component.ts]
export class AppComponent {
public data: Object[];
@ViewChild('grid')
public grid: GridComponent;
public ngOnInit(): void {
this.data = orderDetails;
}
btnClicked(args): void {
const excelExportProperties: ExcelExportProperties = {
fileName: 'new.xlsx'
};
this.grid.excelExport(excelExportProperties);
}
}
|
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.