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

Aggregates on remote datasource

1 Answer 253 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
john
Top achievements
Rank 1
john asked on 19 Nov 2013, 04:15 PM
I am trying to display a simple chart from remote data, but I'm having trouble with aggregates.  For a table of people, I'd like to see a bar chart that shows the number of people in each role.  I think the bottom-line question is, "where are the aggregates calculated?"  Does the framework calculate them on the client side after the data has been returned from the server?  In my ASPNet MVC controller, I can see the expected Kendo.Mvc.GroupDescriptor list and the Kendo.Mvc.IFilterDescriptor list populated correctly, but the Kendo.Mvc.AggregateDescriptor list is empty.  Should it be?  Also, the AggregateFunctions collection in the GroupDescriptor is also empty.  Please advise.

var myDataSource = new kendo.data.DataSource({
        transport: {
            prefix: "",
            read: {
                url: "/Team/TeamMembers",
                type: "POST"
            }
        },
        group: {
            field: "personRole",
            aggregates: [{
                field: "personId",
                aggregate: "count"
            }]
        }
}

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 21 Nov 2013, 10:57 AM
Hello John,

The following part from the documentation clearly answers your main question:

http://docs.kendoui.com/api/framework/datasource#configuration-serverAggregates

"By default the data source calculates aggregates client-side."

However when using the MVC Wrappers for widgets like the Grid, the aggregates are calculated on the server by default (you can change this by the dataSource configuration ServerOperation(false) ) with the help of the Kendo extension methods such As ToDataSourceResult.

Also if using the MVC Kendo Extensions I would suggest you to follow the MVC documentation topic, there are scripts that need to be included.

Kind Regards,
Petur Subev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Data Source
Asked by
john
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or