Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
150277 | Dec 30,2019 04:11 PM UTC | Jan 15,2020 07:13 AM UTC | Angular - EJ 2 | 7 |
![]() |
Tags: Grid |
[app.component.html]
<ejs-grid #grid [dataSource]="data" [editSettings]='editSettings' [toolbar]='toolbar' (actionBegin)="actionBegin($event)">
<e-columns>
. . . .
</e-columns>
<e-aggregates>
<e-aggregate>
<e-columns>
<e-column type="Sum" field="Freight" format="C2">
<ng-template #footerTemplate let-data>Sum: {{data.Sum}}</ng-template>
</e-column>
</e-columns>
</e-aggregate>
</e-aggregates>
</ejs-grid>
[app.component.ts]
public actionBegin(args): void {
if (args.requestType === 'beginEdit') {
this.selectedRecord = {};
this.selectedRecord = args.rowData; // store the edited row data
}
}
public changeFn(args: any) {
const Freight = 'Freight';
this.selectedRecord[Freight] = args.value; // update the edited value of Frieght in stored row date
this.grid.aggregateModule.refresh(this.selectedRecord);
}
|
<div class="control-section">
<ejs-grid #grid [dataSource]='data' height=400 [aggregates]="aggregateColumn" *ngIf='columns.length'[allowPaging] = 'true'>
<e-columns>
<ng-template #colsTemplate ngFor let-column [ngForOf]="columns">
<e-column [field]="column.field" >
</e-column>
</ng-template>
</e-columns>
</ejs-grid>
</div>
|
. . .
this.aggregateColumn = [{
columns: [
{
type: 'Sum',
field: 'Freight',
format: 'C2',
footerTemplate: 'Sum: ${Sum}'
}
]
},
{
columns: [{
type: 'Average',
field: 'Freight',
format: 'C2',
footerTemplate: 'Average: ${Average}'
}]
}
];
}
}
|
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.