您的位置:首页 > 产品设计 > UI/UE

kendo ui treeview设置节点选中

2016-04-13 18:08 811 查看
vartreeview = $("#treeView").data("kendoTreeView");

if(treeview){

treeview.select($());

vartreeNodeData = treeview.dataSource.get(treeNodeId); // treeview.dataSource.options.data[1];

if(treeNodeData){

vartreeNode = treeview.findByText(treeNodeData.text); //根据节点文本进行搜索(请根据实际情况来定),类似的还有treeview.findByUid(id);

if(treeNode){

treeview.select(treeNode); //设置节点选中,

}

}

}

参考地址: http://www.telerik.com/forums/programatically-select-a-tree-node
Hello Andrew,

To achieve this I can suggest the following approach:

Get the dataItem via the get method of the dataSource;
Use the findbyuid method of the TreeView, which searches a TreeView
for a node with the given unique identifier;
In the select method set the result from the previous step.

var
treeview = $(
"#treeview"
).data(
"kendoTreeView"
);

var
getitem = treeview.dataSource.get(9125);

treeview.findByUid(getitem.uid);

var
selectitem = treeview.findByUid(getitem.uid);

treeview.select(selectitem);


Regards,
Iliana Nikolova

the Telerik team
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: