Home > Web Front-end > JS Tutorial > body text

Several methods for automatically folding and expanding JS operating tree nodes_javascript skills

WBOY
Release: 2016-05-16 16:49:55
Original
1907 people have browsed it

1. Method 1

Copy code The code is as follows:

var tree = L5.getCmp(' edocOutfileRelationTree');
//Add selection tree, nodes will automatically collapse
tree.on("click", function(node,e){
node.getUI().toggleCheck(true);
});
tree.root.expand();

2. Method 2
Copy code The code is as follows:

var tree = L5.getCmp('orgstrutree');
//Add a selection tree and the nodes will automatically collapse
tree.on("click" , function(node,e){
if(node.expanded==false){
node.expand();
}else{
node.collapse();
}
});

Used in conjunction with:
Copy code The code is as follows:

var tree = L5.getCmp('orgstrutree');
//Add selection tree, nodes will automatically collapse
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();
}
}
});
} >
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template