3

我正在使用 kendo ui treelist 组件,并从远程源获取数据。数据源定义为:

$("#location-manage-grid").kendoTreeList({
    dataSource: new kendo.data.HierarchicalDataSource({
        transport: {
            read: {
                url: "api/getLocation",
                dataType: "json"
            }
        },
        schema: {
            model: {
                id: "id",
                location: "location",
                hierarchy: "hierarchy",
                hasChildren: "hasChildren",
                map: "map"
            }
        }
    }),
    height: 600,
    pageable: true,
    columns: [
        { field: "hierarchy", title: "Hierarchy", width: 250 },
        { field: "location", title: "location", width: 250 },
        { field: "map", title: "map", width: 250 },
        { title: "Edit", command: [ "edit", "destroy" ], width: 250,  attributes: { style: "text-align: center;" } }
    ]
});

数据源 url 的响应是

[{"hasChildren":true,"hierarchy":"Kendo ui","location":"New York","id":1,"map":true}]

但是,当我运行该应用程序时,它有一个错误,它说:

未捕获的类型错误:无法读取未定义的属性“toLowerCase”

我检查了架构定义,我真的找不到哪里出错了。有谁知道为什么?

4

1 回答 1

3

我发现我犯了什么错误,我应该使用,TreeListDataSource而不是HierarchicalDataSource,这是主要原因。

于 2016-03-25T02:08:30.350 回答