src/eaTreeView.factory.js
function(state, datasetId, items, matchFound, nestingLevel, stopExpandingParents) {
            // initialize whatever wasn't passed to a default value
            datasetId = datasetId || 'default';
            items = items || concealed.items[datasetId];
            matchFound = matchFound || false;
            nestingLevel = nestingLevel || 0;

            for (var i = items.length; --i >= 0;) {
                if (!!items[i].items && !!items[i].items.length) {
                    // matchFound here would mean that a match was found in a descendant
                    matchFound = visible.setActive(state, datasetId, items[i].items, matchFound, nestingLevel + 1, stopExpandingParents);
                    if (matchFound && !stopExpandingParents) {
                        items[i].expanded = true;
                        if (nestingLevel === 0) {
                            stopExpandingParents = true;
                        }
                    }
                } else {
                    if (matchFound) {
                        // matchFound here would mean either a sibling node or some other node was already matched
                        // so we want to skip the comparison to save time
                        items[i].isActive = false;
                    } else {
                        if (!!items[i].stateName && items[i].stateName === state) {
                            // if the item's state is the one being searched for then set the item to active and flip the matched flag
                            items[i].isActive = true;
                            matchFound = true;
                            stopExpandingParents = true;
                        } else {
                            items[i].isActive = false;
                        }
                    }
                }
            }

            return matchFound;
        }
function(state, datasetId, items, matchFound, nestingLevel, stopExpandingParents) {
            // initialize whatever wasn't passed to a default value
            datasetId = datasetId || 'default';
            items = items || concealed.items[datasetId];
            matchFound = matchFound || false;
            nestingLevel = nestingLevel || 0;

            for (var i = items.length; --i >= 0;) {
                if (!!items[i].items && !!items[i].items.length) {
                    // matchFound here would mean that a match was found in a descendant
                    matchFound = visible.setActive(state, datasetId, items[i].items, matchFound, nestingLevel + 1, stopExpandingParents);
                    if (matchFound && !stopExpandingParents) {
                        items[i].expanded = true;
                        if (nestingLevel === 0) {
                            stopExpandingParents = true;
                        }
                    }
                } else {
                    if (matchFound) {
                        // matchFound here would mean either a sibling node or some other node was already matched
                        // so we want to skip the comparison to save time
                        items[i].isActive = false;
                    } else {
                        if (!!items[i].stateName && items[i].stateName === state) {
                            // if the item's state is the one being searched for then set the item to active and flip the matched flag
                            items[i].isActive = true;
                            matchFound = true;
                            stopExpandingParents = true;
                        } else {
                            items[i].isActive = false;
                        }
                    }
                }
            }

            return matchFound;
        }
function ( state , datasetId , items , matchFound , nestingLevel , stopExpandingParents ) { // initialize whatever wasn't passed to a default value datasetId = datasetId || 'default' ; items = items || concealed . items [ datasetId ] ; matchFound = matchFound || false ; nestingLevel = nestingLevel || 0 ; for ( var i = items . length ; -- i >= 0 ; ) { if ( ! ! items [ i ] . items && ! ! items [ i ] . items . length ) { // matchFound here would mean that a match was found in a descendant matchFound = visible . setActive ( state , datasetId , items [ i ] . items , matchFound , nestingLevel + 1 , stopExpandingParents ) ; if ( matchFound && ! stopExpandingParents ) { items [ i ] . expanded = true ; if ( nestingLevel === 0 ) { stopExpandingParents = true ; } } } else { if ( matchFound ) { // matchFound here would mean either a sibling node or some other node was already matched // so we want to skip the comparison to save time items [ i ] . isActive = false ; } else { if ( ! ! items [ i ] . stateName && items [ i ] . stateName === state ) { // if the item's state is the one being searched for then set the item to active and flip the matched flag items [ i ] . isActive = true ; matchFound = true ; stopExpandingParents = true ; } else { items [ i ] . isActive = false ; } } } } return matchFound ; }
set the active item and expand all ancestors of the active item
set the active item and expand all ancestors of the active item