<!DOCTYPE html>
|
<html>
|
<head>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<title>The source code</title>
|
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
|
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>
|
<style type="text/css">
|
.highlight { display: block; background-color: #ddd; }
|
</style>
|
<script type="text/javascript">
|
function highlight() {
|
document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
|
}
|
</script>
|
</head>
|
<body onload="prettyPrint(); highlight();">
|
<pre class="prettyprint lang-js"><span id='Ext-Queryable'>/**
|
</span> * @private
|
* A mixin for providing query related methods for {@link Ext.ComponentQuery} for components that
|
* implement getRefItems.
|
*/
|
Ext.define('Ext.Queryable', {
|
|
<span id='Ext-Queryable-property-isQueryable'> isQueryable: true,
|
</span>
|
<span id='Ext-Queryable-method-query'> /**
|
</span> * Retrieves all descendant components which match the passed selector.
|
* Executes an Ext.ComponentQuery.query using this container as its root.
|
* @param {String} [selector] Selector complying to an Ext.ComponentQuery selector.
|
* If no selector is specified all items will be returned.
|
* @return {Ext.Component[]} Components which matched the selector
|
*/
|
query : function(selector) {
|
selector = selector || '*';
|
return Ext.ComponentQuery.query(selector, this);
|
},
|
|
<span id='Ext-Queryable-method-queryBy'> /**
|
</span> * Retrieves all descendant components which match the passed function.
|
* The function should return false for components that are to be
|
* excluded from the selection.
|
* @param {Function} fn The matcher function. It will be called with a single argument,
|
* the component being tested.
|
* @param {Object} [scope] The scope in which to run the function. If not specified,
|
* it will default to the active component.
|
* @return {Ext.Component[]} Components matched by the passed function
|
*/
|
queryBy: function(fn, scope) {
|
var out = [],
|
items = this.getRefItems(true),
|
i = 0,
|
len = items.length,
|
item;
|
|
for (; i < len; ++i) {
|
item = items[i];
|
if (fn.call(scope || item, item) !== false) {
|
out.push(item);
|
}
|
}
|
return out;
|
},
|
|
<span id='Ext-Queryable-method-queryById'> /**
|
</span> * Finds a component at any level under this container matching the id/itemId.
|
* This is a shorthand for calling ct.down('#' + id);
|
* @param {String} id The id to find
|
* @return {Ext.Component} The matching id, null if not found
|
*/
|
queryById: function(id){
|
return this.down('#' + id);
|
},
|
|
<span id='Ext-Queryable-method-child'> /**
|
</span> * Retrieves the first direct child of this container which matches the passed selector or component.
|
* The passed in selector must comply with an Ext.ComponentQuery selector, or it can be an actual Ext.Component.
|
* @param {String/Ext.Component} [selector] An Ext.ComponentQuery selector. If no selector is
|
* specified, the first child will be returned.
|
* @return Ext.Component The matching child Ext.Component (or `null` if no match was found).
|
*/
|
child: function (selector) {
|
if (selector && selector.isComponent) {
|
selector = '#' + Ext.escapeId(selector.getItemId());
|
}
|
|
selector = selector || '';
|
return this.query('> ' + selector)[0] || null;
|
},
|
|
<span id='Ext-Queryable-method-down'> /**
|
</span> * Retrieves the first descendant of this container which matches the passed selector.
|
* The passed in selector must comply with an Ext.ComponentQuery selector, or it can be an actual Ext.Component.
|
* @param {String/Ext.Component} [selector] An Ext.ComponentQuery selector or Ext.Component. If no selector is
|
* specified, the first child will be returned.
|
* @return Ext.Component The matching descendant Ext.Component (or `null` if no match was found).
|
*/
|
down: function (selector) {
|
if (selector && selector.isComponent) {
|
selector = '#' + Ext.escapeId(selector.getItemId());
|
}
|
|
selector = selector || '';
|
return this.query(selector)[0] || null;
|
},
|
|
<span id='Ext-Queryable-method-getRefItems'> getRefItems: function(){
|
</span> return [];
|
}
|
|
});
|
</pre>
|
</body>
|
</html>
|