2
votes

I want to include a count for the total rows in a grouping in my grouping header, just like the count in this demo: http://demos.telerik.com/kendo-ui/grid/aggregates

I'm using a javascript function as the ClientGroupHeaderTemplate:

columns.Bound(r => r.Status).Title("Status").ClientGroupHeaderTemplate("#= templateFunction(data, statusDisplayArray) #")

And the js function:

function templateFunction(data, statusDisplayArray){
    var count = 0; // total grouped items goes here
    return "Status: " + statusDisplayArray.lookup[data.value][0].displayString + " (" + count + ")";
}

I'm noticing on my data argument there is an aggregates object available, but I'm not sure how to use this to show an aggregate count. I've seen others use an inline template to get the count, but I need a javascript function as the template to allow for some data conversion. How can I achieve an aggregate count in the javascript function for my ClientGroupHeaderTemplate?

1

1 Answers

1
votes

I was able to achieve this by using the following property:

data.aggregates.parent().items.length