C# 如何使用远程数据将超链接配置到Kendo UI树视图中?
这是我的树视图:C# 如何使用远程数据将超链接配置到Kendo UI树视图中?,c#,javascript,asp.net,kendo-ui,kendo-treeview,C#,Javascript,Asp.net,Kendo Ui,Kendo Treeview,这是我的树视图: function CreateNotificationTree(UserId) { var data = new kendo.data.HierarchicalDataSource({ transport: { read: { url: "../api/notifications/byuserid/" + UserId, contentType: "applicati
function CreateNotificationTree(UserId)
{
var data = new kendo.data.HierarchicalDataSource({
transport: {
read: {
url: "../api/notifications/byuserid/" + UserId,
contentType: "application/json"
}
},
schema: {
model: {
children: "notifications"
}
}
});
$("#treeview").kendoTreeView({
dataSource: data,
loadOnDemand: true,
dataUrlField: "LinksTo",
checkboxes: {
checkChildren: true
},
dataTextField: ["notificationType", "NotificationDesc"]
});
}
我添加了配置“dataUrlField”,但我不确定如何将dataTextField“NotificationDesc”配置为API中的超链接
API“./API/notifications/byuserid/”
将返回树视图的数据以及我需要的链接。以下是API返回的内容:
<ArrayOfNode xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http....WebUI.Controllers" debug="true">
<script id="FirebugLite" firebugIgnore="true" extension="Chrome"/>
<Node>
<notificationType>Edit Items</notificationType>
<notifications>
<Notification>
<ActionPageName>abc/ViewMembers.aspx</ActionPageName>
<ID>10285433</ID>
<NotificationDesc>2013 project</NotificationDesc>
<NotificationLink>
//the link I need is here
</NotificationLink>
<Params>...</Params>
</Notification>
...
编辑项目
abc/ViewMembers.aspx
10285433
2013年项目
//我需要的链接在这里
...
...
我想出了办法:
$("#treeview").kendoTreeView({
dataSource: data,
loadOnDemand: true,
dataUrlField: "LinksTo",
checkboxes: {
checkChildren: true
},
dataTextField: ["notificationType", "NotificationDesc"],
select: treeviewSelect
});
function treeviewSelect(e)
{
var node = this.dataItem(e.node);
window.open(node.NotificationLink, "_self");
}
我想出了办法:
$("#treeview").kendoTreeView({
dataSource: data,
loadOnDemand: true,
dataUrlField: "LinksTo",
checkboxes: {
checkChildren: true
},
dataTextField: ["notificationType", "NotificationDesc"],
select: treeviewSelect
});
function treeviewSelect(e)
{
var node = this.dataItem(e.node);
window.open(node.NotificationLink, "_self");
}