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
--- | ---
| BLANK_IMAGE_URL : String URL to a 1x1 transparent gif image used by Ext to create inline icons with CSS background images. (Defaults to "http:... URL to a 1x1 transparent gif image used by Ext to create inline icons with CSS background images. (Defaults to "http://extjs.com/s.gif" and you should change this to a URL on your server). | Ext
| SSL_SECURE_URL : String URL to a blank file used by Ext when in secure mode for iframe src and onReady src to prevent the IE insecure content... URL to a blank file used by Ext when in secure mode for iframe src and onReady src to prevent the IE insecure content warning (defaults to javascript:false). | Ext
| emptyFn : Function A reusable empty function | 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
| 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
| 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
| 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
| isWindows : Boolean True if the detected platform is Windows. | Ext
| useShims : Boolean By default, Ext intelligently decides whether floating elements should be shimmed. If you are using flash, you may wa... By default, Ext intelligently decides whether floating elements should be shimmed. If you are using flash, you may want to set this to true. | Ext

## Public Methods

Method | Defined By
--- | ---
| addBehaviors( `Object obj` ) : void Applies event listeners to elements by selectors when the document is ready. The event name is specified with an @ su... Applies event listeners to elements by selectors when the document is ready. The event name is specified with an @ suffix.
    Ext.addBehaviors({
       // add a listener for click on all anchors in element with id foo
       '#foo a@click' : function(e, t){
           // do something
       },

       // add the same listener to multiple selectors (separated by comma BEFORE the @)
       '#foo a, #bar span.some-class@mouseover' : function(){
           // do something
       }
    });
Parameters: `obj` : Object The list of behaviors to apply Returns: `void` | Ext
| 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` ) : Object Shorthand for Ext.util.JSON.decode Shorthand for Ext.util.JSON.decode Parameters: `json` : String The JSON string Returns: `Object` The resulting object | Ext
| destroy( `Mixed arg1`, [`Mixed arg2`], [`Mixed etc...`] ) : void Attempts to destroy any objects passed to it by removing all event listeners, removing them from the DOM (if applicab... Attempts to destroy any objects passed to it by removing all event listeners, removing them from the DOM (if applicable) and calling their destroy functions (if available). This method is primarily intended for arguments of type Ext.Element and Ext.Component, but any subclass of Ext.util.Observable can be passed in. Any number of elements and/or components can be passed into this function in a single call as separate arguments. Parameters: `arg1` : Mixed An Ext.Element or Ext.Component to destroy `arg2` : Mixed (optional) `etc...` : Mixed (optional) Returns: `void` | 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
| escapeRe( `String str` ) : String Escapes the passed string for use in a regular expression Escapes the passed string for use in a regular expression Parameters: `str` : String Returns: `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 <static> Gets the globally shared flyweight Element, with the passed node as the active element. Do not store a... <static> 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 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 "_internal") Returns: `Element` The shared Element object | Ext
| get( `Mixed el` ) : Element Static method to retrieve Element objects. Uses simple caching to consistently return the same object. Automatically ... Static method to retrieve Element objects. 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 | 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
| getCmp( `String id` ) : Ext.Component Shorthand for Ext.ComponentMgr.get Shorthand for Ext.ComponentMgr.get Parameters: `id` : String Returns: `Ext.Component` | Ext
| getDoc() : Ext.Element Returns the current HTML document object as an Ext.Element. Returns the current HTML document object as an Ext.Element. Parameters: None. Returns: `Ext.Element` The document | Ext
| getDom( `Mixed el` ) : HTMLElement Return the dom node for the passed string (id), dom node, or Ext.Element Return the dom node for the passed string (id), dom node, or Ext.Element 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 The` ) : 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: `The` : Object object to test Returns: `Boolean` | Ext
| isDate( `Object The` ) : Boolean Returns true if the passed object is a JavaScript date object, otherwise false. Returns true if the passed object is a JavaScript date object, otherwise false. Parameters: `The` : Object object to test Returns: `Boolean` | Ext
| isEmpty( `Mixed value`, [`Boolean allowBlank`] ) : Boolean Returns true if the passed value is null, undefined or an empty string (optional). Returns true if the passed value is null, undefined or an empty string (optional). Parameters: `value` : Mixed The value to test `allowBlank` : Boolean (optional) Pass true if an empty string is not considered empty 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. Usage: Ext.namespace('C... Creates namespaces to be used for scoping variables and classes so that they are not global. Usage:
    Ext.namespace('Company', 'Company.data');
    Company.Widget = function() { ... }
    Company.data.CustomStore = function(config) { ... }
Parameters: `namespace1` : String `namespace2` : String `etc` : String Returns: `void` | Ext
| num( `Mixed value`, `Number defaultValue` ) : Number Utility method for validating that a value is numeric, returning the specified default value if it is not. Utility method for validating that a value is numeric, returning the specified default value if it is not. Parameters: `value` : Mixed Should be a number, but any type will be handled appropriately `defaultValue` : Number The value to return if the original value is non-numeric Returns: `Number` Value, if numeric, else defaultValue | Ext
| onReady( `Function fn`, `Object scope`, `boolean override` ) : 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 `override` : boolean If true, the obj passed in becomes the execution scope of the listener 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
| reg( `String xtype`, `Constructor cls` ) : void Shorthand for Ext.ComponentMgr.registerType Shorthand for Ext.ComponentMgr.registerType Parameters: `xtype` : String The mnemonic string by which the Component class may be looked up. `cls` : Constructor The new Component class. Returns: `void` | 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
| select( `String/Array selector`, [`Boolean unique`], [`HTMLElement/String root`] ) : CompositeElementLite/CompositeElement Selects elements based on the passed CSS selector to enable working on them as 1. Selects elements based on the passed CSS selector to enable working on them as 1. Parameters: `selector` : String/Array The CSS selector or an array of elements `unique` : Boolean (optional) true to create a unique Ext.Element for each element (defaults to a shared flyweight object) `root` : HTMLElement/String (optional) The root element of the query or id of the root Returns: `CompositeElementLite/CompositeElement` | Ext
| type( `Mixed object` ) : String Returns the type of object that is passed in. If the object passed in is null or undefined it return false otherwise ... Returns the type of object that is passed in. If the object passed in is null or undefined it return false otherwise it returns one of the following values: string: If the object passed is a string number: If the object passed is a number boolean: If the object passed is a boolean value function: If the object passed is a function reference object: If the object passed is an object array: If the object passed is an array regexp: If the object passed is a regular expression element: If the object passed is a DOM Element nodelist: If the object passed is a DOM NodeList textnode: If the object passed is a DOM text node and contains something other than whitespace whitespace: If the object passed is a DOM text node and contains only whitespace Parameters: `object` : Mixed Returns: `String` | Ext
| urlDecode( `String string`, [`Boolean overwrite`] ) : Object Takes an encoded URL and and converts it to an object. e.g. Ext.urlDecode("foo=1&bar=2"); would return {foo: 1, bar: ... Takes an encoded URL and and converts it to an object. e.g. Ext.urlDecode("foo=1&bar=2"); would return {foo: 1, bar: 2} or Ext.urlDecode("foo=1&bar=2&bar=3&bar=4", true); would return {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.