Kendo UI Grid Grouping with Aggregate: Use aggregate value of another column in Group header?
kendo-asp.net-mvc, kendo-grid, kendo-ui
Solution
You can access the average in `data.aggregates`, which will contain the aggregates for the relevant group:
groupHeaderTemplate: "Units In Stock: #= value # (Count: #= count#)" +
"(avg: #= aggregates.UnitsOnOrder.average #)"
(demo)
Problem
I want to use the aggregate value in another column (not the grouping column) in grouping header. For example, here is the demo from Kendo: http://demos.telerik.com/kendo-ui/grid/aggregates It aggregate the Units On Order for Units In Stock. I want to show the Average 14 in grouping header (besides Count: 5). Is it possible? I tried to use template in header, ``` groupHeaderTemplate: "Units In Stock: #=value# (#=getAverage(data)# / #=count#)" ``` Then in getAverage(), I calculated the value based on data. ``` var aggregates = ds.aggregates(); var averaged = aggregates.UnitsOnOrder.average; ``` However, the average is the average of all rows, not the data within the group. Any suggestions? Thanks