eachOpen

iterates through opened nodes of the tree (both parent and child)

void eachOpen(function code, [object master,string pid] );
codefunctiona function that needs calling for each data item
masterobjectan object that the function is applied to (this by default)
pidstringthe parent node id. Used to iterate through a specific branch

Example

//iterates through all items of the tree
tree.data.eachOpen(function(obj){
   console.log(obj.value)
});
 
//iterates through items with $parent="2"
tree.data.eachOpen(function(obj){
   console.log(obj.value)
}, this, "2");

Details

Be aware of the following issues:

  • eachOpen iterates through both parent and child nodes.
  • The eachOpen's function takes the data item object as a parameter.
  • If you specify the 3rd parameter (pid), eachOpen will iterate only through child nodes of the branch (without iterating through the specified parent node).
See also
Back to top