Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
145005 | May 31,2019 08:48 PM UTC | Jun 4,2019 06:23 AM UTC | Angular - EJ 2 | 3 |
![]() |
Tags: Grid |
[app.component.html]
<ejs-grid class="sortingenabled" [dataSource]='data' allowPaging='true'>
<e-columns>
<ng-template ngFor let-column [ngForOf]="columns">
<e-column [field]="column.field"
[headerText]="column.headerText"
[allowEditing]="column.allowEditing"
[isPrimaryKey]="column.isPrimaryKey != null ? column.isPrimaryKey : null"
[width]="column.width">
</e-column>
</ng-template>
</e-columns>
</ejs-grid>
---------------------------------------------------------------------------------
[app.component.ts]
export class AppComponent {
public data: Object[];
public columns: any;
public jsonHeaderText: object[];
constructor( ) {
}
public ngOnInit(): void {
this.data = data.slice(0,50);
this.jsonHeaderText = [{"OrderID":"Ordering Detail",
"CustomerName":"Customer Name Detail","ShipCountry":"Shipping Country",
"OrderDate":"Ordering Date"}];
this.columns = [{ field: 'OrderID', headerText: this.jsonHeaderText[0]["OrderID"] , isPrimaryKey: true, width: 120, textAlign: 'Right' },
{ field: 'Freight', width: 125, format: 'C2' },
{ field: 'CustomerID', headerText: 'Customer ID', width: 130 },
{ field: 'ShipName', headerText: 'Ship Name', width: 180 }];
}
}
|
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.