我有这个 CSS 类:
.relationshipsTree
{
display: inline;
font-size: 10pt;
text-decoration: none;
/*cursor: hand;*/
overflow: hidden;
overflow-x: hidden;
overflow-y: hidden;
filter: none;
font-weight: bold;
color: green;
background-color: transparent;
}
我想在这个剑道树视图的父节点上使用它:
<div id="relationshipsTree"></div>
我该怎么做呢?
编辑 -
这是我用来创建树的 .js 文件。我补充说:
$('#relationshipsTree').parent().addClass('relationshipsTree');
但是,根据此处的答案,它仍然无法正常工作。
整个文件:
function CreateRelationshipsTree()
{
var primaryContactId = 671;
var personOrCompany = 'C';
var rootMemberId = 0;
var data = new kendo.data.HierarchicalDataSource({
transport: {
read: {
url: "../api/relationships?primaryContactId=" + primaryContactId + "&personOrCompany=" + personOrCompany + "&rootMemberId=" + rootMemberId,
contentType: "application/json"
}
},
schema: {
model: {
hasChildren: "hasChildren",
children: "Items"
}
}
});
$("#relationshipsTree").kendoTreeView({
dataSource: data,
loadOnDemand: true,
dataUrlField: "LinksTo",
dataTextField: ["Name", "Name"],
select: treeviewSelect
});
function treeviewSelect(e) {
var node = this.dataItem(e.node);
window.open(node.NotificationLink, "_self");
}
$('#relationshipsTree').parent().addClass('relationshipsTree');
}
function RefreshProjectTree() {
var treeView = $("#relationshipsTree").data("kendoTreeView");
treeView.dataSource.read();
}