问题
I am having trouble with the Hierarchical Data Source in conjunction with the TreeView and nesting. The goal is to show a treeview with root items like "employees", "profiles" and sub items being the acutal items. So every root item is using a different data source. This is not working, as the root nodes are not expanding while the data source seems to load perfectly. Here's the code:
$(document).ready(function() {
var userProfileDataSource = new kendo.data.HierarchicalDataSource( {
transport: {
read: function (options) {
var items = [
{
text: "userprofile 1",
hasChildren: false
},
{
text: "userprofile 2",
hasChildren: false
}
];
options.success(items);
}
}
}),
categories = new kendo.data.HierarchicalDataSource({
transport: {
read: function(options) {
options.success([
{
text: "Employees",
hasChildren: false
},
{
text: "UserProfiles",
children: userProfileDataSource,
hasChildren: true
}
]);
}
}
});
$("#navigation-treeview").kendoTreeView( { dataSource: categories } );
});
JSFiddle
Any ideas?
来源:https://stackoverflow.com/questions/16016983/nested-datasources-and-treeview-with-kendo-ui