我是Kendo UI新手。我的Asp.net MVC應用程序有一個Kendo UI樹視圖,它的設置如下。每個樹節點都有一個唯一的Id(例如EmployeeId,它是整數)。如何以編程方式選擇Kendo UI樹視圖的根節點(ID爲1),並且根節點的背景顏色應該是高亮的?感謝您的幫助。如何以編程方式選擇Kendo UI treeview的根節點
var _root = new kendo.data.HierarchicalDataSource({
transport: {
read: {
cache: false,
url: "/Employee/GetEmployees",
dataType: "json",
data: { employeeId: _selectedId}
}
},
schema: {
model: {
id: "Id",
hasChildren: "HasChildren",
expanded: "expanded",
parentId: "parentId",
ItemType: "ItemType"
}
}
});
_tree = $("#treeView").kendoTreeView({
dataSource: _root,
dataTextField: "Name",
loadOnDemand: true,
dataImageUrlField: "Image",
dataBound: function (e) {
handleTreeDataBound(e);
},
select: function (e) {
handleSelect(e.node);
}
});
treeViewCtrl = $("#treeView").data("kendoTreeView");
非常感謝您,您的代碼工作得非常好。 –