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();
}
}
});