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
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With