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

Question about Grid Aggregations

4 Answers 53 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Congyuan
Top achievements
Rank 1
Congyuan asked on 30 Nov 2015, 07:25 PM

Hi, I have a few question about the aggregations feature of the Kendo grid. I've attached a picture to you that it will be easier for me to explain my requirements.

My question is if i want to apply the paging on this grid that summation values will be the summation of current page. Is it possible i can calculate it on server side and populate the sum result into the bottom row on Kendo grid?

 

 

4 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 02 Dec 2015, 07:40 AM
Hello Congyuan,

The desired functionality is supported by the kendo grid widget however the aggregates must be calculated on the server side as well in order to be correct. There are two configuration settings which apply to data source server aggregates:
http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-serverAggregates
http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-schema.aggregates
The aggregates are sent to the remote service as defined in the parameterMap:
http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-transport.parameterMap

I hope this helps.

Regards,
Radoslav
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Congyuan
Top achievements
Rank 1
answered on 09 Dec 2015, 07:43 PM

Could you please give me simple example of this? Seems there's no any good example for this feature, but in real world the server side sum makes a lot more sense than the client side one. But most difficult things is there's no any example shows how the server side JSON looks like. If you can provide it it will be great.

 

Thanks.

 

 

0
Accepted
Radoslav
Telerik team
answered on 10 Dec 2015, 07:39 AM
Hi Congyuan,

Please check out following threads which elaborates on the aggregates json format returned form the server and how it can be generated with server side code:
http://www.telerik.com/forums/server-aggregates
http://stackoverflow.com/questions/23649952/kendo-grid-server-side-grouping
For example if the data source is configured like this:
var dataSource = new kendo.data.DataSource({
      transport: {
        /* transport configuration */
      }
      serverAggregates: true,
      aggregate: [
        { field: "unitPrice", aggregate: "max" },
        { field: "unitPrice", aggregate: "min" },
        { field: "ProductName", aggregate: "count" }
      ]
    });
The aggregate results should have the following format:
{
  unitPrice: {
      max: 100,
      min: 1
  },
  productName: {
      count: 42
  }
}

I hope this helps.

Regards,
Radoslav
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Congyuan
Top achievements
Rank 1
answered on 10 Dec 2015, 01:55 PM
Thank you so much, now it works. 
Tags
Grid
Asked by
Congyuan
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Congyuan
Top achievements
Rank 1
Share this question
or