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();
}
}
});
复制代码 代码如下:
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();
}
}
});
相关文章
深入理解JavaScript系列(12) 变量对象(Variable Object)
JavaScript编程的时候总避免不了声明函数和变量,以成功构建我们的系统,但是解释器是如何并且在什么地方去查找这些函数和变量呢2012-01-01


最新评论