这是我的树状视图:
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>
...
参考方案
我想出了办法:
$("#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");
}
Kendo DropdownList从模型设置值 - c#这是我的实体编辑页面代码,@(Html.Kendo().DropDownListFor(x => x.ParentCategoryId).Name("ParentCategoryId").HtmlAttributes(new { style = "width:300px;" }).DataTextField(…
Kendo Grid hasChanges,如何处理只读网格? - javascript我目前想遍历每个Kendo网格,并在有未决更改的情况下警告用户。为此,我使用方法hasChanges()(我使用批处理编辑):$(".k-grid").each(function () { if ($(this).data('kendoGrid').dataSource.hasChanges()) { //Warn u…
当回复有时是一个对象有时是一个数组时,如何在使用改造时解析JSON回复? - java我正在使用Retrofit来获取JSON答复。这是我实施的一部分-@GET("/api/report/list") Observable<Bills> listBill(@Query("employee_id") String employeeID); 而条例草案类是-public static class…
如何从jquery ui .sortable()获取数据? - php这是我的代码:$(".img-line").sortable({ update:function(){ var order = $('.img-line').sortable('serialize'); $.ajax({ type: 'POST', data: order, ur…
改造正在返回一个空的响应主体 - java我正在尝试使用Retrofit和Gson解析一些JSON。但是,我得到的响应机构是空的。当我尝试从对象中打印信息时,出现NullPointerException。我确保URL正确,并且我也确保POJO也正确。我正在使用jsonschema2pojo来帮助创建POJO类。这是我要解析的JSON{ "?xml": { "@versi…