Js操作树节点自动折叠展开的几种方法

 更新时间:2014年05月05日 10:54:22   作者:  
这篇文章主要介绍了Js操作树节点自动折叠展开的几种方法,需要的朋友可以参考下
1、方法一
复制代码 代码如下:

var tree = L5.getCmp('edocOutfileRelationTree');
//增加选择树,节点自动折叠
tree.on("click", function(node,e){
node.getUI().toggleCheck(true);
});
tree.root.expand();

2、方法二
复制代码 代码如下:

var tree = L5.getCmp('orgstrutree');
//增加选择树,节点自动折叠
tree.on("click", function(node,e){
if(node.expanded==false){
node.expand();
}else{
node.collapse();
}
});

结合使用:
复制代码 代码如下:

var tree = L5.getCmp('orgstrutree');
//增加选择树,节点自动折叠
tree.on("click", function(node,e){
var organType = node.record.get("organType");
if(organType == "8"){
node.getUI().toggleCheck(true);
}else{
if(node.expanded==false){
node.expand();
}else{
node.collapse();
}
}
});

相关文章

最新评论