diff --git a/libs/jsonTree/jsonTree.js b/libs/jsonTree/jsonTree.js index 51bbf01..487546f 100644 --- a/libs/jsonTree/jsonTree.js +++ b/libs/jsonTree/jsonTree.js @@ -543,8 +543,9 @@ var jsonTree = (function() { * Expands this list of node child nodes * * @param isRecursive {boolean} - if true, expands all child nodes + * @param {Function} filterFunc - 'true' if this node should be expanded */ - expand : function(isRecursive){ + expand : function(isRecursive, filterFunc){ if (this.isEmpty) { return; } @@ -556,7 +557,14 @@ var jsonTree = (function() { if (isRecursive) { this.childNodes.forEach(function(item, i) { if (item.isComplex) { - item.expand(isRecursive); + if (typeof filterFunc == 'function'){ + if(filterFunc(item)){ + item.expand(isRecursive, filterFunc); + } + } else { + item.expand(isRecursive); + } + } }); } @@ -745,7 +753,7 @@ var jsonTree = (function() { if (typeof filterFunc == 'function') { this.rootNode.childNodes.forEach(function(item, i) { if (item.isComplex && filterFunc(item)) { - item.expand(); + item.expand('recursive', filterFunc); } }); } else {