Hello,
I am using the demo here as a base https://www.telerik.com/kendo-angular-ui/components/grid/data-binding/automatic-operations/
I have bound my grid to local array and added an aggregate which is working. The only thing that doesn't update is the Grand Total aggregate at the bottom of the grid.
My Grid definition:
<
kendo-grid
[kendoGridGroupBinding]="data"
[height]="700"
[pageSize]="50"
[sortable]="true"
[filterable]="'menu'"
scrollable
=
"virtual"
[selectable]="true"
[resizable]="true"
[loading]="this.loading"
[pageable]="true"
[groupable]="{ showFooter: true }">
<
kendo-grid-column
field
=
"ColumnA"
title
=
"ColumnA"
width
=
"250"
>
</
kendo-grid-column
>
<
kendo-grid-column
field
=
"ColumnB"
title
=
"ColumnB"
width
=
"180"
>
</
kendo-grid-column
>
<
kendo-grid-column
field
=
"AccountValue"
title
=
"AccountValue"
width
=
"180"
[format]="'{0:N2}'">
<
ng-template
kendoGridGroupFooterTemplate
let-group
=
"group"
let-aggregates>Total: {{aggregates["AccountValue"]?.sum | number: '1.2-2' }}</
ng-template
>
<
ng-template
kendoGridFooterTemplate
let-column
=
"column"
>Grand Total: {{total["AccountValue"]?.sum | number: '1.2-2' }}</
ng-template
>
</
kendo-grid-column
>
</
kendo-grid
>
My component code:
public header: any;
public importId: number;
public loading =
true
;
public data: any = [];
public aggregates: any[] = [{field:
'AccountValue'
, aggregate:
'sum'
}];
public total: any = aggregateBy(
this
.data,
this
.aggregates);
constructor(private staticDataService: StaticDataService,
private activateRoute: ActivatedRoute) { }
ngOnInit() {
this
.importId =
this
.activateRoute.snapshot.params.id;
this
.loadData();
}
public loadData() {
this
.staticDataService.getData(
this
.importId).subscribe(data => {
this
.data = data;
this
.loading =
false
;
});
}
The grouping, sorting and filtering all work great and the Group Totals are updated correctly, the Grand Total amount always stays the same.
How can I update this based on changes to the grid?
Thanks