each

iterates through the collection of tree data items

void each(function code,object master,boolean all,string pid);
codefunctiona function that needs calling for each data item
masterobjectan object that the function is applied to (this by default)
allbooleanif true, hidden (as well as hidden by filtering) items are iterated
pidstringthe parent node id. Used to iterate through a specific branch

Example

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

Details

Note that

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