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

sum is not defined

2 Answers 1359 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jay
Top achievements
Rank 2
Jay asked on 21 Oct 2015, 06:26 PM

I realize that these forums are chock full of posts about this, and I have read most of them yet my problem remains.  I'm trying to use the most basic implementation of aggregates, and I keep getting the error 'sum is not defined' or as in my jsFiddle example 'count is not defined'. Could someone please take a look and tell me what I am doing wrong?

var rawData = {
    allData: [
        { employeeId: 1, departmentId: 2 },
        { employeeId: 2, departmentId: 1 },
        { employeeId: 3, departmentId: 3 },
        { employeeId: 4, departmentId: 2 }
    ],
    employees: [
        { value: 1, text: 'John Smith' },
        { value: 2, text: 'Jane Smith' },
        { value: 3, text: 'John Doe' },
        { value: 4, text: 'John White' },
    ],
    departments: [
        { value: 1, text: 'Dept A' },
        { value: 2, text: 'Dept B' },
        { value: 3, text: 'Dept C' },
    ]
};
 
var vm = {
    dsAllData: new kendo.data.DataSource({
        data: rawData.allData
    })
};
 
$(document).ready(function() {
    //kendo.bind($('#ui'), vm);
    $('#myGrid').kendoGrid({
        dataSource: vm.dsAllData,
        groupable: true,
        columns: [
            { field: 'employeeId', title: 'Employee',
             values: rawData.employees, width: 200 },
            { field: 'departmentId', title: 'Department',
             values: rawData.departments, width: 200,
             aggrigate: ['count'], groupFooterTemplate: 'Count: #= count #' }       
        ]
    });
});

Thanks, Jay

2 Answers, 1 is accepted

Sort by
0
Accepted
Iliana Dyankova
Telerik team
answered on 23 Oct 2015, 12:00 PM
Hi Jay,

I believe the issue is caused by incorrect syntax - it must (not ). I.e.:
//....
{ field: 'departmentId', title: 'Department', values: rawData.departments, width: 200,
    aggregates: ['count'], groupFooterTemplate: 'Count: #= count #' }  
//....

Regards,
Iliana Nikolova
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Jay
Top achievements
Rank 2
answered on 23 Oct 2015, 03:13 PM

If I would have known how important spelling was to programming, I would have paid more attention in English class!

Thanks for catching that!

-Jay

Tags
Grid
Asked by
Jay
Top achievements
Rank 2
Answers by
Iliana Dyankova
Telerik team
Jay
Top achievements
Rank 2
Share this question
or