Properties Methods Events Direct Link

# Class Ext

Package: | Global
Defined In: | Ext.js
Class: | Ext
Extends: | Object

Ext core utilities and functions.
This class is a singleton and cannot be created directly.

## Public Properties

Property | Defined By
--- | ---
| enableFx : Boolean True if the Ext.Fx Class is available | Ext
| enableGarbageCollector : Boolean True to automatically uncache orphaned Ext.Elements periodically (defaults to true) | Ext
| enableListenerCollection : Boolean True to automatically purge event listeners after uncaching an element (defaults to false). Note: this only happens i... True to automatically purge event listeners after uncaching an element (defaults to false). Note: this only happens if enableGarbageCollector is true. | Ext
| isAir : Boolean True if the detected platform is Adobe Air. | Ext
| isBorderBox : Boolean True if the detected browser is Internet Explorer running in non-strict mode. | Ext
| isChrome : Boolean True if the detected browser is Chrome. | Ext
| isGecko : Boolean True if the detected browser uses the Gecko layout engine (e.g. Mozilla, Firefox). | Ext
| isGecko2 : Boolean True if the detected browser uses a pre-Gecko 1.9 layout engine (e.g. Firefox 2.x). | Ext
| isGecko3 : Boolean True if the detected browser uses a Gecko 1.9+ layout engine (e.g. Firefox 3.x). | Ext
| isIE : Boolean True if the detected browser is Internet Explorer. | Ext
| isIE6 : Boolean True if the detected browser is Internet Explorer 6.x. | Ext
| isIE7 : Boolean True if the detected browser is Internet Explorer 7.x. | Ext
| isIE8 : Boolean True if the detected browser is Internet Explorer 8.x. | Ext
| isLinux : Boolean True if the detected platform is Linux. | Ext
| isMac : Boolean True if the detected platform is Mac OS. | Ext
| isOpera : Boolean True if the detected browser is Opera. | Ext
| isReady : Boolean True when the document is fully initialized and ready for action | Ext
| isSafari : Boolean True if the detected browser is Safari. | Ext
| isSafari2 : Boolean True if the detected browser is Safari 2.x. | Ext
| isSafari3 : Boolean True if the detected browser is Safari 3.x. | Ext
| isSafari4 : Boolean True if the detected browser is Safari 4.x. | Ext
| isSecure : Boolean True if the page is running over SSL | Ext
| isStrict : Boolean True if the browser is in strict (standards-compliant) mode, as opposed to quirks mode | Ext
| isWebKit : Boolean True if the detected browser uses Webkit. | Ext
| isWindows : Boolean True if the detected platform is Windows. | Ext

## Public Methods

Method | Defined By
--- | ---
| apply( `Object obj`, `Object config`, `Object defaults` ) : Object Copies all the properties of config to obj. Copies all the properties of config to obj. Parameters: `obj` : Object The receiver of the properties `config` : Object The source of the properties `defaults` : Object A different object that will also be applied for default values Returns: `Object` returns obj | Ext
| applyIf( `Object obj`, `Object config` ) : Object Copies all the properties of config to obj if they don't already exist. Copies all the properties of config to obj if they don't already exist. Parameters: `obj` : Object The receiver of the properties `config` : Object The source of the properties Returns: `Object` returns obj | Ext
| decode( `String json`, [`Boolean safe`] ) : Object Shorthand for Ext.util.JSON.decode Shorthand for Ext.util.JSON.decode Parameters: `json` : String The JSON string `safe` : Boolean (optional) Whether to return null or throw an exception if the JSON is invalid. Returns: `Object` The resulting object | Ext
| each( `Array/NodeList/Mixed array`, `Function fn`, `Object scope` ) : void Iterates an array calling the passed function with each item, stopping if your function returns false. If the passed ... Iterates an array calling the passed function with each item, stopping if your function returns false. If the passed array is not really an array, your function is called once with it. The supplied function is called with (Object item, Number index, Array allItems). Parameters: `array` : Array/NodeList/Mixed `fn` : Function `scope` : Object Returns: void | Ext
| encode( `Mixed o` ) : String Shorthand for Ext.util.JSON.encode Shorthand for Ext.util.JSON.encode Parameters: `o` : Mixed The variable to encode Returns: `String` The JSON string | Ext
| extend( `Function subclass`, `Function superclass`, [`Object overrides`] ) : Function Extends one class with another class and optionally overrides members with the passed literal. This class also adds t... Extends one class with another class and optionally overrides members with the passed literal. This class also adds the function "override()" to the class that can be used to override members on an instance. This function also supports a 2-argument call in which the subclass's constructor is not passed as an argument. In this form, the parameters are as follows: `superclass` The class being extended `overrides` A literal with members which are copied into the subclass's prototype, and are therefore shared among all instances of the new class. This may contain a special member named `constructor`. This is used to define the constructor of the new class, and is returned. If this property is not specified, a constructor is generated and returned which just calls the superclass's constructor passing on its parameters. For example, to create a subclass of the Ext GridPanel:
    MyGridPanel = Ext.extend(Ext.grid.GridPanel, {
        constructor: function(config) {
            // Your preprocessing here
            MyGridPanel.superclass.constructor.apply(this, arguments);
            // Your postprocessing here
        },

        yourMethod: function() {
            // etc.
        }
    });
Parameters: `subclass` : Function The class inheriting the functionality `superclass` : Function The class being extended `overrides` : Object (optional) A literal with members which are copied into the subclass's prototype, and are therefore shared between all instances of the new class. Returns: `Function` The subclass constructor. | Ext
| fly( `String/HTMLElement el`, [`String named`] ) : Element Gets the globally shared flyweight Element, with the passed node as the active element. Do not store a reference to t... Gets the globally shared flyweight Element, with the passed node as the active element. Do not store a reference to this element - the dom node can be overwritten by other code. Shorthand of Ext.Element.fly Use this to make one-time references to DOM elements which are not going to be accessed again either by application code, or by Ext's classes. If accessing an element which will be processed regularly, then Ext.get will be more appropriate to take advantage of the caching provided by the Ext.Element class. Parameters: `el` : String/HTMLElement The dom node or id `named` : String (optional) Allows for creation of named reusable flyweights to prevent conflicts (e.g. internally Ext uses "_global") Returns: `Element` The shared Element object (or null if no matching element was found) | Ext
| get( `Mixed el` ) : Element Retrieves Ext.Element objects. This method does not retrieve Components. This method retrieves Ext.Element objects wh... Retrieves Ext.Element objects. This method does not retrieve Components. This method retrieves Ext.Element objects which encapsulate DOM elements. To retrieve a Component by its ID, use Ext.ComponentMgr.get. Uses simple caching to consistently return the same object. Automatically fixes if an object was recreated with the same id via AJAX or DOM. Shorthand of Ext.Element.get Parameters: `el` : Mixed The id of the node, a DOM Node or an existing Element. Returns: `Element` The Element object (or null if no matching element was found) | Ext
| getBody() : Ext.Element Returns the current document body as an Ext.Element. Returns the current document body as an Ext.Element. Parameters: None. Returns: `Ext.Element` The document body | Ext
| getDom( `Mixed el` ) : HTMLElement Return the dom node for the passed string (id), dom node, or Ext.Element. Note: the dom node to be found actually nee... Return the dom node for the passed string (id), dom node, or Ext.Element. Note: the dom node to be found actually needs to exist (be rendered, etc) when this method is called to be successful. Parameters: `el` : Mixed Returns: `HTMLElement` | Ext
| id( [`Mixed el`], [`String prefix`] ) : String Generates unique ids. If the element already has an id, it is unchanged Generates unique ids. If the element already has an id, it is unchanged Parameters: `el` : Mixed (optional) The element to generate an id for `prefix` : String (optional) Id prefix (defaults "ext-gen") Returns: `String` The generated Id. | Ext
| isArray( `Object object` ) : Boolean Returns true if the passed object is a JavaScript array, otherwise false. Returns true if the passed object is a JavaScript array, otherwise false. Parameters: `object` : Object The object to test Returns: `Boolean` | Ext
| isEmpty( `Mixed value`, [`Boolean allowBlank`] ) : Boolean Returns true if the passed value is empty. The value is deemed to be empty if it is<div class="mdetail-params"> null ... Returns true if the passed value is empty. The value is deemed to be empty if it is null undefined an empty array a zero length string (Unless the `allowBlank` parameter is `true`) Parameters: `value` : Mixed The value to test `allowBlank` : Boolean (optional) true to allow empty strings (defaults to false) Returns: `Boolean` | Ext
| isFunction( `Object object` ) : Boolean Returns true if the passed object is a JavaScript Function, otherwise false. Returns true if the passed object is a JavaScript Function, otherwise false. Parameters: `object` : Object The object to test Returns: `Boolean` | Ext
| isObject( `Object object` ) : Boolean Returns true if the passed object is a JavaScript Object, otherwise false. Returns true if the passed object is a JavaScript Object, otherwise false. Parameters: `object` : Object The object to test Returns: `Boolean` | Ext
| isPrimitive( `Mixed value` ) : Boolean Returns true if the passed object is a JavaScript 'primitive', a string, number or boolean. Returns true if the passed object is a JavaScript 'primitive', a string, number or boolean. Parameters: `value` : Mixed The value to test Returns: `Boolean` | Ext
| namespace( `String namespace1`, `String namespace2`, `String etc` ) : void Creates namespaces to be used for scoping variables and classes so that they are not global. Specifying the last node... Creates namespaces to be used for scoping variables and classes so that they are not global. Specifying the last node of a namespace implicitly creates all other nodes. Usage:
    Ext.namespace('Company', 'Company.data');
    Ext.namespace('Company.data'); // equivalent and preferable to above syntax
    Company.Widget = function() { ... }
    Company.data.CustomStore = function(config) { ... }
Parameters: `namespace1` : String `namespace2` : String `etc` : String Returns: void | Ext
| onReady( `Function fn`, `Object scope`, [`boolean options`] ) : void Fires when the document is ready (before onload and before images are loaded). Shorthand of Ext.EventManager.onDocum... Fires when the document is ready (before onload and before images are loaded). Shorthand of Ext.EventManager.onDocumentReady. Parameters: `fn` : Function The method the event invokes `scope` : Object An object that becomes the scope of the handler `options` : boolean (optional) An object containing standard addListener options Returns: void | Ext
| override( `Object origclass`, `Object overrides` ) : void Adds a list of functions to the prototype of an existing class, overwriting any existing methods with the same name. ... Adds a list of functions to the prototype of an existing class, overwriting any existing methods with the same name. Usage:
    Ext.override(MyClass, {
        newMethod1: function(){
            // etc.
        },
        newMethod2: function(foo){
            // etc.
        }
    });
Parameters: `origclass` : Object The class to override `overrides` : Object The list of functions to add to origClass. This should be specified as an object literal containing one or more methods. Returns: void | Ext
| query( `String path`, [`Node root`] ) : Array Selects an array of DOM nodes by CSS/XPath selector. Shorthand of Ext.DomQuery.select Selects an array of DOM nodes by CSS/XPath selector. Shorthand of Ext.DomQuery.select Parameters: `path` : String The selector/xpath query `root` : Node (optional) The start of the query (defaults to document). Returns: `Array` | Ext
| removeNode( `HTMLElement node` ) : void Removes a DOM node from the document. The body node will be ignored if passed in. Removes a DOM node from the document. The body node will be ignored if passed in. Parameters: `node` : HTMLElement The node to remove Returns: void | Ext
| toArray( `Iterable the` ) : (Array) Converts any iterable (numeric indices and a length property) into a true array Don't use this on strings. IE doesn't... Converts any iterable (numeric indices and a length property) into a true array Don't use this on strings. IE doesn't support "abc"[0] which this implementation depends on. For strings, use this instead: "abc".match(/./g) => [a,b,c]; Parameters: `the` : Iterable iterable object to be turned into a true Array. Returns: `(Array)` array | Ext
| urlDecode( `String string`, [`Boolean overwrite`] ) : Object Takes an encoded URL and and converts it to an object. Example: Ext.urlDecode("foo=1&bar=2"); // returns {foo: "1", b... Takes an encoded URL and and converts it to an object. Example:
    Ext.urlDecode("foo=1&bar=2"); // returns {foo: "1", bar: "2"}
    Ext.urlDecode("foo=1&bar=2&bar=3&bar=4", false); // returns {foo: "1", bar: ["2", "3", "4"]}
Parameters: `string` : String `overwrite` : Boolean (optional) Items of the same name will overwrite previous values instead of creating an an array (Defaults to false). Returns: `Object` A literal with members | Ext
| urlEncode( `Object o` ) : String Takes an object and converts it to an encoded URL. e.g. Ext.urlEncode({foo: 1, bar: 2}); would return "foo=1&bar=2". ... Takes an object and converts it to an encoded URL. e.g. Ext.urlEncode({foo: 1, bar: 2}); would return "foo=1&bar=2". Optionally, property values can be arrays, instead of keys and the resulting string that's returned will contain a name/value pair for each array value. Parameters: `o` : Object Returns: `String` | Ext

## Public Events

This class has no public events.