Hi All

I have been going through the classes we have developed over the last few years and sharing back with the community some of them that I think will be useful to others. These components have been tested extensively in ext-3.2.1.

Here is: Ext.ux.ComponentQuery

A singleton used to search for components and execute javascript on them.

Code:
/**
 * @author Will Ferrer, Ethan Brooks
 * @copyright (c) 2012, Intellectual Property Private Equity Group
 * @licensee 2012 developed under license for Switchsoft LLC http://www.switchsoft.com a "Direct response telephony company" as part of it's "VOIP Call distribution, ROI analysis platform, call recording, and IVR for inbound and outbound sales" and Run the Business Systems LLC a "Technology development investment group" as part of it's "PHP, Javascript rapid application development framework and MySQL analysis tools"
 * @license licensed under the terms of
 * the Open Source LGPL 3.0 license.  Commercial use is permitted to the extent
 * that the code/component(s) do NOT become part of another Open Source or Commercially
 * licensed development library or toolkit without explicit permission.
 * <p>License details: <a href="http://www.gnu.org/licenses/lgpl.html"
 * target="_blank">http://www.gnu.org/licenses/lgpl.html</a></p>
* We are pretty nice just ask. We want to meet our licensees
*/
/*
 * @class Ext.ux.ComponentQuery
 * @singleton
 * @extends Object
 * A singleton used to search for components and execute javascript on them.
 * {"search":[{"gridName":"cancelPublisher"}], "execute":[{"functionName":"reload", "arguments":[]}]}
 * @constructor
 * @param {Object} config The config object
 */
Ext.ns('Ext.ux');
Ext.ux.ComponentQuery = function(){
    return {
        /** Public Function: search
         * A function that searchs through all the components in the component manager. It takes a string and evals it checking for true on each component, or if an object was passed it checks for name value pairs passed in the object to be present on the component, if true it adds the component to the array of components it will return. If an array was passed it will treat each element in the array as a separate "OR" test
         * @param {String|Object|Array} searchParams (Required) the string to eval on each component in order to test if should be returned or not
         * @return Array
         */
        search : function (searchParams) {
            var foundComponents = [],
                searchParams = (Ext.isArray(searchParams))?searchParams:[searchParams],
                curSearchParams, obj, n, matches;
            Ext.ComponentMgr.all.each(function (item, index, length) {
                for(n=0;n<searchParams.length;n++) {
                    curSearchParams = searchParams[n];
                    if (typeof(curSearchParams) == 'string') {
                        if (this.evalString.call(item, curSearchParams)) {
                            foundComponents.push(item);
                            break;
                        }
                    } else {
                        matches = true;
                        for(obj in curSearchParams){
                            if (item[obj] != curSearchParams[obj]) {
                                matches = false;
                                break;
                            }
                        }
                        if (matches) {
                            foundComponents.push(item);
                            break;
                        }
                    }
                }
            }, this);
            return foundComponents;
        },
        /** Public Function: execute
         * A function that exeuctes code on a single component. the code may be object containing: functionName : [functionName], [arguments], or it may be a string that will be evaled with the target component as its scope.
         * @param {String|Object} target (Required) a string to pass Ext.getCmp or a component its self to run the executeParams on.
         * @param {String|Object} executeParams (Required) the string to eval on on the target component or an object of functionName : [functionName], [arguments] to run on the component
         * @return Array
         */
        execute : function (target, executeParams) {
            var target = (typeof(curExecuteParam) == 'string')?Ext.getCmp(target):target,
                executeParams = (Ext.isArray(executeParams))?executeParams:[executeParams],
                n, curExecuteParam, functionName, arguments;
            for(n=0;n<executeParams.length;n++) {
                curExecuteParam = executeParams[n];
                if (typeof(curExecuteParam) == 'string') {
                    this.evalString.call(target, curExecuteParam);
                } else {
                    functionName = curExecuteParam['functionName'];
                    arguments = curExecuteParam['arguments'];
                    target[functionName].apply(target, arguments);
                }
            };
        },
        /** Public Function: searchAndExecute
         * a function that takes an object containing search params and execute params. the search params are used to look through all the objets in the Ext.ComponentMgr (each search param is passed to the search method of this class to accomplish this) and then the execute params of the object are run via the execute method of this class.
         * @param {Array|Object} info (Required) an array or single object containing the search params to be used by the search method of this class (stored with in a key of 'search') and the params to execute stored with a key of execute
         * @return Array
         */
        searchAndExecute : function (params) {
            var params = (Ext.isArray(params))?params:[params],
                foundComponents = [],
                n, n2, curSearchParams, curexecuteParams, curFoundComponents, curComponent;
            for(n=0;n<params.length;n++) {
                curSearchParams = params[n]['search'];
                curTarget = params[n]['target'];
                curexecuteParams = params[n]['execute'];
                if (!Ext.isEmpty(curTarget)) {
                    curFoundComponents = curTarget;
                } else {
                    curFoundComponents = Ext.ux.ComponentQuery.search(curSearchParams);
                }
                foundComponents = foundComponents.concat(curFoundComponents);
                for(n2=0;n2<foundComponents.length;n2++) {
                    curComponent = curFoundComponents[n2];
                    Ext.ux.ComponentQuery.execute(curComponent, curexecuteParams);
                }
            }

        },
        // @private
        evalString : function (string) {
            var returnObj = eval(string);
            return returnObj;
        }
    };
}();
Ext.reg('ux-componentquery', Ext.ux.ComponentQuery);
Best regards

Will Ferrer (Run the Business)