|
[app.component.html]
<div class="control-section">
<ejs-grid [dataSource]="data" [allowPaging]="true" [pageSettings]='pageOption' [columns]='columns' [aggregates]="aggregates">
</ejs-grid>
</div>
-------------------------------------------------------------------------------------------------- [app.component.ts]
export class AppComponent {
public data: Object[];
public pageOption: Object = {pageCount: 5};
public columns: Object;
public aggregates: Object;
public ngOnInit(): void {
this.data = orderData;
this.columns = [
{ field: 'CustomerName', headerText: 'Customer Name', textAlign: 'Right', width: 150 },
{ field: 'Freight', headerText: 'Freight', textAlign: 'Right', width: 150, format: 'C2' },
{ field: 'OrderDate', headerText: 'Order Date', width: 150, textAlign: 'Right', format: 'yMd' },
{ field: 'ShipCountry', headerText: 'ShipCountry', width: 150 },
];
this.aggregates = [{
columns: [{
type: 'Sum',
field: 'Freight',
format: 'C2',
footerTemplate: 'Sum: ${Sum}'
}]
},
{
columns: [{
type: 'Average',
field: 'Freight',
format: 'C2',
footerTemplate: 'Average: ${Average}'
}]
}]
}
} |