I'm currently facing an issue with the Kendo Grid aggregate function that I'm struggling to resolve.
Within the grid, I have multiple rows with numerical values. My goal is to display the total sum of these rows at the bottom of the grid.
The functionality is already implemented and can be seen in action in this fiddle:
$(document).ready(function () {
$("#grid").kendoGrid({
dataSource: {
type: "odata",
transport: {
read: "http://demos.kendoui.com/service/Northwind.svc/Products"
},
pageSize: 7,
aggregate: [{
field: "ProductName",
aggregate: "count"
}, {
field: "UnitPrice",
aggregate: "sum"
}, {
field: "UnitsOnOrder",
aggregate: "sum"
}, {
field: "UnitsInStock",
aggregate: "min"
}, {
field: "UnitsInStock",
aggregate: "max"
}]
},
sortable: true,
scrollable: false,
pageable: true,
columns: [{
field: "ProductName",
title: "Product Name",
footerTemplate: "Total Count: #=count#",
}, {
field: "UnitPrice",
title: "Unit Price"
}, {
field: "UnitsOnOrder",
title: "Units On Order",
footerTemplate: "Sum: #=sum#",
}]
});
});
The issue I'm facing, as shown in the fiddle, is that the sum calculation includes all rows across all pages. I'm looking to calculate the sum only for the rows on the current page.
Does anyone have any suggestions on how to modify the fiddle to achieve this?
The project is developed in Angular, if that information is relevant.
Thank you in advance.