## Function(filter, isSingle, parentNode, invokeParam)zTreeObj.getNodesByFilter

### Overview[ depends on jquery.ztree.core js ]

Search the single node's data or collection of nodes's data by custom rules.

Can be customized complex search rules.

Please use zTree object to executing the method.

### Function Parameter Descriptions

#### filterFunction

Custom search function. e.g. function filter(node) {...}

filter's parameter: node (node's data -- JSON)

filter's return: boolean (true means: match the rules; false means: don't match the rules)

#### isSingleBoolean

isSingle = true means: search only one node

isSingle = false means: search the array of the nodes

If this parameter is omitted, as same as false

#### parentNodeJSON

The search range, you can search node from a parent node's child nodes.

If this parameter is omitted, zTree will search node from all nodes.

#### invokeParamanything

Custom data object by user, used to calculate in the filter function.

#### Return Array(JSON) / JSON

If isSingle = true, will return the first node's data (JSON) what be matched. If no match, return null.

If isSingle = false, will return the array of all nodes's data what be matched. if no match, return [ ].

### Examples of function

#### 1. Search the nodes which their 'name' contains 'test' and 'level' is 2.

    function filter(node) {
        return (node.level == 2 && node.name.indexOf("test")>-1);
    }
    ......
    var treeObj = $.fn.zTree.getZTreeObj("tree");
    var node = treeObj.getNodesByFilter(filter, true); // search only one node
    var nodes = treeObj.getNodesByFilter(filter); // search the array of the nodes