我确信我必须做一些愚蠢的事;就我所知,这似乎是HeirarchicalDataSource的教科书用法。
var domtree = [{
"id": "linear1",
"element-class": "LinearLayout",
"children": [{
"id": "static1",
"element-class": "Static"
}, {
"id": "static2",
"element-class": "Static",
"children": [{
"id": "static3",
"element-class": "Static"
}]
}, {
"id": "4",
"element-class": "Error"
}]
}];
var inline = new kendo.data.HierarchicalDataSource({
data: domtree,
schema: {
model: {
id: "id",
children: "children"
}
}
});
$("#navtree").kendoTreeView({
dataSource: inline,
dataTextField: "id"
});
非常感谢能够指出我做错了什么的人!
答案 0 :(得分:1)
我只是将字段children
更改为items
。
这是一个jsfiddle:http://jsfiddle.net/nn007/N8Svz/6/
答案 1 :(得分:0)
如果您添加这样的架构属性,它可能会起作用。您告诉分层数据源儿童的关键是什么。像这样:
schema:{model:{children:" children" }}