This is a migrated thread and some comments may be shown as answers.

Server-side aggregates

1 Answer 787 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brian Vallelunga
Top achievements
Rank 1
Brian Vallelunga asked on 11 Feb 2014, 05:24 PM
I'm having trouble getting server-side aggregated results to work. This is what I currently have set up:

The DataSource is built in JS with no server-side wrappers:

serverAggregates: true,
schema: {
    aggregates: function(response) {
         return response.aggregatedResults;
    }
},
aggregate: [
    { field: "Revenue", aggregate: "sum" }
]


The JSON data being returned has: 

{
    "aggregatedResults": {
         "Revenue": {
               "sum": 123245"
         }
    }
}


The grid appears, with an aggregate row at the bottom, but empty cells. My questions are:

Since this is all server-side, why does Kendo need to know what type of aggregate it is (sum, count, etc)? Is there just a "value" type?
If the schema definition for the DataSource includes an aggregates function, why do I need to then re-specify the aggregates lower down?
Do I need to specify a formatting template for each footer cell, or are there defaults automatically applied?
Are my issues with the DataSource or the Grid?

Thanks!

1 Answer, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 13 Feb 2014, 03:49 PM
Hello Brian,

schema.aggreates defines the field in the server response which contains the calculated aggregates.

aggregate option defines what aggregate function must be calculated. Those functions will be send to server when read request is issued in order to instruct the server handler what data is required.

In order to show aggregates from DataSource inside Grid footer you must define footerTemplate for the columns. There is no default template containing all options from data source per field.

Regards,
Nikolay Rusev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Brian Vallelunga
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Share this question
or