我使用 KendoUI 树视图绑定到远程数据,下面是我的代码:
<script>
var serviceRoot = "/kendoui";
var Taxonomys = {
schema: {
model: {
id: "Name",
hasChildren: function () {
return false;
}
}
},
transport: {
read: {
url: function (options) {
return kendo.format("http://localhost/MySite/MySiteService.svc/Organization/{1}/Project/{0}/Taxonomy?includeSchema=0", options.Name);
}
}
}
};
var Projects = {
schema: {
model: {
id: "Name",
hasChildren: function () {
return true;
},
children: Taxonomys
}
},
transport: {
read: {
url: function (options) {
return kendo.format("http://localhost/MySite/MySiteService.svc/Organization/{0}/Project", options.Name);
}
}
}
};
homogeneous = new kendo.data.HierarchicalDataSource({
transport: {
read: {
url: "http://localhost/MySite/MySiteService.svc/Organization ",
dataType: "jsonp"
}
},
schema: {
model: {
id: "Name",
hasChildren: function () {
return true;
},
children: Projects
}
}
});
$("#treeview").kendoTreeView({
dataSource: homogeneous,
dataTextField: ["Name", "Name", "Name"]
});
</script>
在分类法中,我需要组织名称。
http://localhost/MySite/MySiteService.svc/Organization/{1}/Project/{0}/Taxonomy?includeSchema=0
但“url: function (options) {}”中的选项只有项目的名称。如何获得项目的父级名称?