Pepito Fernandez
Pepito Fernandez

Reputation: 2440

Telerik MVC Extensions Grid Aggregate with Ajax Binding returns zero

Well, i decided to give it a try to Telerik MVC Extensions v.2012.2.607.340

I am having a problem with aggregating a decimal field in their grid.

I am using ajax binding.

I have an Action that returns a json

return Json(data);

data is nothing but a List. it converts into json without problems. My grid is showing the data but the aggregation is not working. returns 0 (zero). i am following their examples here

I went to their forum/community but i couldn't find any solution to this. maybe they dropped the ball since they made it into Kendo something and they are charging a "grand" for it.

Anyone has had the same problem?

Thanks

Upvotes: 1

Views: 627

Answers (1)

Milos Mijatovic
Milos Mijatovic

Reputation: 975

You need to return something like this:

return Json(new { 
    Data = typeof(IEnumerable),
    Total = typeof(int),
    Aggregates = typeof(Dictionary<string, object>)
});

You need to precalculate Aggregates though. Key of a Dictionary is name of the field, and its value is calculated aggregate.

Upvotes: 1

Related Questions