Kendo ui:Uncaught TypeError:无法读取属性&to;低级数据库'未定义的

时间:2016-03-24 03:23:29

标签: javascript jquery kendo-ui kendo-treelist

我正在使用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;" } }
    ]
});

数据源网址的响应为

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

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

  

未捕获的TypeError:无法读取属性' toLowerCase'未定义的

我已经检查了架构定义,我真的无法找到出错的地方。有谁知道为什么?

1 个答案:

答案 0 :(得分:2)

我发现我犯了哪些错误,我应该使用TreeListDataSource代替HierarchicalDataSource,这是主要原因。