kendoTreeList - 聚合无法正常工作

kendoTreeList - aggregate not working properly

请帮助我,我对 kendoTreeList 的聚合感到困惑 - 我创建了 kendoTreeList,但无法计算组的总和。

$(document).ready(function () {
            var _jsondata = [
                      { ID: 1, Name: "Parent 1", Amount: "200", parentId: null },
                      { ID: 2, Name: "Parent 2", Amount: "500", parentId: null },
                      { ID: 11, Name: "Child 11", Amount: "50", parentId: 1 },
                      { ID: 12, Name: "Child 12", Amount: "150", parentId: 1 },
                      { ID: 21, Name: "Child 21", Amount: "100", parentId: 2 },
                      { ID: 22, Name: "Child 22", Amount: "200", parentId: 2 },
                      { ID: 23, Name: "Child 23", Amount: "200", parentId: 2 }                          
                    ];
            var dataSource = new kendo.data.TreeListDataSource({
                data    : _jsondata,
                schema  : { model: { id: "ID", expanded: true }},
                aggregate   : [
                    { field: "Amount", aggregate: "sum"}
                ]
            });
            $("#treelist").kendoTreeList({
                dataSource  : dataSource,                    
                columns     : [
                    { field: "Name" , nullable: false },
                    { field: "Amount",  footerTemplate: "#= sum #"}
                ]
            });
        });

结果为 -

由于Amount_jsondata中表示为string,您需要在schema.model中将其定义为number

schema: {
    model: { 
        id: "ID",
        expanded: true,
        fields: {
            Amount: { type: 'number' }
        }
    }
},