Upgrade to ExtJS 4.0.2 - Released 06/09/2011
[extjs.git] / docs / output / Ext.ComponentQuery.js
1 Ext.data.JsonP.Ext_ComponentQuery({
2   "allMixins": [
3
4   ],
5   "deprecated": null,
6   "docauthor": null,
7   "members": {
8     "cfg": [
9
10     ],
11     "method": [
12       {
13         "deprecated": null,
14         "alias": null,
15         "protected": false,
16         "tagname": "method",
17         "href": "ComponentQuery.html#Ext-ComponentQuery-method-is",
18         "shortDoc": "Tests whether the passed Component matches the selector string. ...",
19         "static": false,
20         "filename": "/mnt/ebs/nightly/git/SDK/platform/src/ComponentQuery.js",
21         "private": false,
22         "params": [
23           {
24             "type": "Ext.Component",
25             "optional": false,
26             "doc": "<p>The Component to test</p>\n",
27             "name": "component"
28           },
29           {
30             "type": "String",
31             "optional": false,
32             "doc": "<p>The selector string to test against.</p>\n",
33             "name": "selector"
34           }
35         ],
36         "name": "is",
37         "owner": "Ext.ComponentQuery",
38         "doc": "<p>Tests whether the passed Component matches the selector string.</p>\n",
39         "linenr": 399,
40         "return": {
41           "type": "Boolean",
42           "doc": "<p>True if the Component matches the selector.</p>\n"
43         },
44         "html_filename": "ComponentQuery.html"
45       },
46       {
47         "deprecated": null,
48         "alias": null,
49         "protected": false,
50         "tagname": "method",
51         "href": "ComponentQuery.html#Ext-ComponentQuery-method-query",
52         "shortDoc": "Returns an array of matched Components from within the passed root object. ...",
53         "static": false,
54         "filename": "/mnt/ebs/nightly/git/SDK/platform/src/ComponentQuery.js",
55         "private": false,
56         "params": [
57           {
58             "type": "String",
59             "optional": false,
60             "doc": "<p>The selector string to filter returned Components</p>\n",
61             "name": "selector"
62           },
63           {
64             "type": "Ext.container.Container",
65             "optional": false,
66             "doc": "<p>The Container within which to perform the query.\nIf omitted, all Components within the document are included in the search.</p>\n\n<p>This parameter may also be an array of Components to filter according to the selector.</p></p>\n",
67             "name": "root"
68           }
69         ],
70         "name": "query",
71         "owner": "Ext.ComponentQuery",
72         "doc": "<p>Returns an array of matched Components from within the passed root object.</p>\n\n<p>This method filters returned Components in a similar way to how CSS selector based DOM\nqueries work using a textual selector string.</p>\n\n<p>See class summary for details.</p>\n",
73         "linenr": 348,
74         "return": {
75           "type": "[Ext.Component]",
76           "doc": "<p>The matched Components.</p>\n"
77         },
78         "html_filename": "ComponentQuery.html"
79       }
80     ],
81     "property": [
82
83     ],
84     "cssVar": [
85
86     ],
87     "cssMixin": [
88
89     ],
90     "event": [
91
92     ]
93   },
94   "singleton": true,
95   "alias": null,
96   "superclasses": [
97
98   ],
99   "protected": false,
100   "tagname": "class",
101   "mixins": [
102
103   ],
104   "href": "ComponentQuery.html#Ext-ComponentQuery",
105   "subclasses": [
106
107   ],
108   "static": false,
109   "author": null,
110   "component": false,
111   "filename": "/mnt/ebs/nightly/git/SDK/platform/src/ComponentQuery.js",
112   "private": false,
113   "alternateClassNames": [
114
115   ],
116   "name": "Ext.ComponentQuery",
117   "doc": "<p>Provides searching of Components within <a href=\"#/api/Ext.ComponentManager\" rel=\"Ext.ComponentManager\" class=\"docClass\">Ext.ComponentManager</a> (globally) or a specific\n<a href=\"#/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a> on the document with a similar syntax to a CSS selector.</p>\n\n<p>Components can be retrieved by using their <a href=\"#/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">xtype</a> with an optional . prefix</p>\n\n<ul>\n<li><code>component</code> or <code>.component</code></li>\n<li><code>gridpanel</code> or <code>.gridpanel</code></li>\n</ul>\n\n\n<p>An itemId or id must be prefixed with a #</p>\n\n<ul>\n<li><code>#myContainer</code></li>\n</ul>\n\n\n<p>Attributes must be wrapped in brackets</p>\n\n<ul>\n<li><code>component[autoScroll]</code></li>\n<li><code>panel[title=\"Test\"]</code></li>\n</ul>\n\n\n<p>Member expressions from candidate Components may be tested. If the expression returns a <em>truthy</em> value,\nthe candidate Component will be included in the query:</p>\n\n<pre><code>var disabledFields = myFormPanel.query(\"{isDisabled()}\");\n</code></pre>\n\n<p>Pseudo classes may be used to filter results in the same way as in <a href=\"#/api/Ext.DomQuery\" rel=\"Ext.DomQuery\" class=\"docClass\">DomQuery</a>:</p>\n\n<pre><code>// Function receives array and returns a filtered array.\nExt.ComponentQuery.pseudos.invalid = function(items) {\n    var i = 0, l = items.length, c, result = [];\n    for (; i &lt; l; i++) {\n        if (!(c = items[i]).isValid()) {\n            result.push(c);\n        }\n    }\n    return result;\n};\n\nvar invalidFields = myFormPanel.query('field:invalid');\nif (invalidFields.length) {\n    invalidFields[0].getEl().scrollIntoView(myFormPanel.body);\n    for (var i = 0, l = invalidFields.length; i &lt; l; i++) {\n        invalidFields[i].getEl().frame(\"red\");\n    }\n}\n</code></pre>\n\n<p>Default pseudos include:</p>\n\n<ul>\n<li>not</li>\n</ul>\n\n\n<p>Queries return an array of components.\nHere are some example queries.</p>\n\n<pre><code>// retrieve all Ext.Panels in the document by xtype\nvar panelsArray = Ext.ComponentQuery.query('panel');\n\n// retrieve all Ext.Panels within the container with an id myCt\nvar panelsWithinmyCt = Ext.ComponentQuery.query('#myCt panel');\n\n// retrieve all direct children which are Ext.Panels within myCt\nvar directChildPanel = Ext.ComponentQuery.query('#myCt &gt; panel');\n\n// retrieve all grids and trees\nvar gridsAndTrees = Ext.ComponentQuery.query('gridpanel, treepanel');\n</code></pre>\n\n<p>For easy access to queries based from a particular Container see the <a href=\"#/api/Ext.container.Container-method-query\" rel=\"Ext.container.Container-method-query\" class=\"docClass\">Ext.container.Container.query</a>,\n<a href=\"#/api/Ext.container.Container-method-down\" rel=\"Ext.container.Container-method-down\" class=\"docClass\">Ext.container.Container.down</a> and <a href=\"#/api/Ext.container.Container-method-child\" rel=\"Ext.container.Container-method-child\" class=\"docClass\">Ext.container.Container.child</a> methods. Also see\n<a href=\"#/api/Ext.Component-method-up\" rel=\"Ext.Component-method-up\" class=\"docClass\">Ext.Component.up</a>.</p>\n",
118   "mixedInto": [
119
120   ],
121   "linenr": 1,
122   "xtypes": [
123
124   ],
125   "html_filename": "ComponentQuery.html",
126   "extends": "Object"
127 });