Specs
Kendo: 2012.3.1114
.Net: 4.5
MVC: 4.0
Problem
I am binding my grid using a DataTable as the Model and I need to have aggregate values. If I use the snippet below as my base (taken from the Kendo UI Code Library) there seems to be no way to set up the aggregate functions.
@(Html.Kendo().Grid(Model) .Name("Grid") .Columns(columns => { foreach (System.Data.DataColumn column in Model.Columns) { columns.Bound(column.DataType, column.ColumnName); } }) .Pageable() .Sortable() .Scrollable() .Filterable() .Groupable() .DataSource(dataSource => dataSource .Ajax() .Read(read => read.Action("Read", "Home")) ) ) Back in the days of the Telerik MVC controls I could set up the aggregate function you could setup the aggregate while adding the bound column but in the Kendo UI wrapper that has been moved down to be inside of the DataSource.
Telerik Grid:
columns.Bound("ColumnName").Aggregate(aggregates => aggregates.Count().Min().Max()) If I try and set up the agregate down in the DataSource I get a lovely exception "'count' is undefined" which is a bit vague.
if (column.ColumnName == "ProductID") { columns .Bound(column.DataType, column.ColumnName) .ClientFooterTemplate("Count: #=count#"); } ... .Aggregates(aggregates => { aggregates.Add(a => "ProductID").Count(); }) Is there any way to get around the aggregate problem?