Kendo ui:未捕获类型错误:无法读取属性'至小写'的未定义

Kendo ui: Uncaught TypeError: Cannot read property 'toLowerCase' of undefined

本文关键字:未定义 属性 ui 类型 Kendo 错误 读取      更新时间:2023-09-26

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

$("#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"

我已经检查了模式定义,真的找不到哪里出了问题。有人知道为什么吗?

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