This is a migrated thread and some comments may be shown as answers.

Problem summing across multiple groups

1 Answer 211 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Matt asked on 25 Sep 2015, 01:55 AM
I've created a Kendo grid that groups on 2 fields. So it groups on one field, and then further subgroups within the groups on a second field. I need to show sums for a third field for each group and subgroup.

The sums for the subgroups appear ok.
But the sums for the groups are wrong - they show the sum for all records instead of the sum per group.

This can be reproduced by pasting the code below in one of the demo areas in

<div id="grid"></div>
 columns: [
{ field: "company", groupHeaderTemplate: "#= value #" },
{ field: "department",  groupHeaderTemplate: "#= value #" },
{ field: "headcount",  groupFooterTemplate: "#= sum #", footerTemplate: "#= sum #" }
 dataSource: {
data: [
 { company: "IBM", department: "Software", headcount: 4000 },
 { company: "IBM", department: "Software", headcount: 5000 },
 { company: "Apple", department: "Hardware", headcount: 2000 },
 { company: "IBM", department: "Hardware", headcount: 7000 },
 { company: "Apple", department: "Software", headcount: 6000 }

 aggregate: [
{ field: "headcount", aggregate: "sum" }

group: [
 { field: "company" },
 { field: "department", aggregates: [ { field: "headcount", aggregate: "sum" }] }

How can I achieve correct multi level summing in a kendo grid?

1 Answer, 1 is accepted

Sort by
Plamen Lazarov
Telerik team
answered on 28 Sep 2015, 02:03 PM

Hello Matt,

You need to set the aggregates property for both the company and department fields in the grouping configuration. Please see the updated version of your implementation and let me know if it helps.

Plamen Lazarov
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Asked by
Top achievements
Rank 1
Answers by
Plamen Lazarov
Telerik team
Share this question