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

Kendo Grid Aggregate not working

1 Answer 552 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Raj asked on 09 Dec 2016, 04:46 PM

I am trying to display the Sum of the Amount per ReceivedOn on the group footer.

Please help me to find what is wrong in here...

var dataSource = new{
            transport: {
                read: {
                    url: THIS_APP_PATH + "Reports/Monthly/DepositList",
                    dataType: "json"
            schema: {
                parse: function (response) {
                    var amounts = [];
                    $.each(response.Amounts, function (i, amount) {
                        var amount = {
                            Id: amount.Id,
                            Amount: amount.Amount,
                            ReceivedOn: amount.Check != null ? amount.ReceivedOn : null,
                            Originator: amount.Check != null ? amount.Check.Originator : null,
                            CheckNumber: amount.Check != null ? amount.Check.Number : null,
                            CheckDate: amount.Check != null ? amount.Check.Date : null,
                            Comments: amount.Comments
                    return amounts;
                model: {
                    id: "Id",
                    fields: {
                        Id: { type: "number" },
                        ReceivedOn: { type: "date" },
                        Originator: { type: "string" },
                        CheckNumber: { type: "string" },
                        CheckDate: { type: "date" },
                        Amount: { type: "number" },
                        Comments: { type: "string" }
                group: [{
                    field: "ReceivedOn"//, aggregates: [{ field: "Amount", aggregates: "sum" }]
                aggregate: [{ field: "Amount", aggregate: "sum" }]
            dataSource: dataSource,
            pageable: false,
            groupable: false,
            columns: [               
                { field: "ReceivedOn", title: "Received On", format: "{0:MM/dd/yyyy}"},
                { field: "Originator", title: "Originator", width: 200, groupFooterTemplate: "Total: #=sum#" },
                { field: "CheckNumber", title: "Check #", groupFooterTemplate: "Total: #=sum#" },
                { field: "CheckDate", title: "Check Date", format: "{0:MM/dd/yyyy}" },
                { field: "Amount", format:"{0:c}"},
                { field: "Comments", title: "Comments", width: 250, groupFooterTemplate: "Total: #=sum#" },
                { field: "Amount", groupFooterTemplate: "Total: #=sum#" }               

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 13 Dec 2016, 08:42 AM
Hello Raj,

If I understand correctly the desired result is to group by the ReceivedOn column and to display a groupFooterTemplate under the Amount column showing the sum of all amounts.

If this is correct the group and the aggregates are correctly set, but I noticed the groupFooterTemplate is also set for columns which aggregates are not set.

Please check the example if the desired result is to display aggregates for only one column:

Also, please check our example if more than one column will have aggregates:

If my assumption is not correct please provide more information about the scenario and I will gladly assist.

Telerik by Progress
Kendo UI is ready for Visual Studio 2017 RC! Learn more.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question