【发布时间】:2016-08-16 09:05:21
【问题描述】:
我想将本地和远程数据绑定到同一个 Kendo UI 控件。 这里我使用的是剑道树形视图。
这里前两个节点是硬编码的(本地数据),第三个需要来自数据库(远程数据)。所以现在如何处理这个。
$("#AftermarketTreeView").kendoTreeView({
dataTextField: ["text", "text", "MC_ANALYSIS_NAME"],
dataSource: {
data: [
{
text: "Initiate",
items: [
{ text: "Parts Selection", haschildren: false },
{ text: "Assumptions", haschildren: false },
{ text: "Team", haschildren: false },
]
},
{
text: "Analyze",
items: [
{ text: "Part Attributes", haschildren: false },
{ text: "Aftermarket Evaluation", haschildren: false }
]
},
{
text: "Monto Carlo",
items: [
{ text: "Monto Carlo", haschildren: true }
]
}
],
schema: {
model: {
hasChildren: "items",
children: {
schema: {
data: "items",
model: {
hasChildren: "haschildren",
children: {
schema: {
// override the schema.data setting from the parent
data: function (response) {
return response;
}
},
transport: {
read: {
url: ResolveUrl("/CreateMaintainAnalysis/GetMontoCarloData/"),
dataType: "jsonp",
data:onDataSendAnalysisID,
}
},
}
}
}
}
}
}
}
});
那么如何使用 Kendo TreeView 进行绑定呢?
【问题讨论】:
-
现在是怎么编码的?您是否为每个树根使用一个数据源,您能否展示更多代码如何创建数据源并将其附加到树视图?
-
现在我还没有使用任何数据源,因为我不知道如何继续,所以到目前为止我已经在 UI 上使用了 HardCoded HTML
-
你能不能不要尝试提出一个概念并将你的努力发回给我们,以便我们可以帮助你解决问题?
-
@Icepickle,我尝试并编辑了上面的数据..现在你能帮我吗?
标签: javascript kendo-ui kendo-asp.net-mvc kendo-treeview