Print Friendly

# Class Ext

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

Ext core utilties and functions
This class is a singleton and cannot be created directly.
Properties - Methods - Events

## Public Properties

Property | Defined By
--- | ---
| BLANK_IMAGE_URL : String | Ext
URL to a 1x1 transparent gif image used by Ext to create inline icons with CSS background images. (Defaults to "http:...
| SSL_SECURE_URL : String | Ext
URL to a blank file used by Ext when in secure mode for iframe src and onReady src to prevent the IE insecure content...
| isReady : Boolean | Ext
True when the document is fully initialized and ready for action
| isSecure : Boolean | Ext
True if the page is running over SSL
| isStrict : Boolean | Ext
True if the browser is in strict mode
| useShims : Boolean | Ext
By default, Ext intelligently decides whether floating elements should be shimmed. If you are using flash, you ...

## Public Methods

Method | Defined By
--- | ---
| addBehaviors(`Object obj`) : void | Ext
Applies event listeners to elements by selectors when the document is ready. The event name is specified with an @ su...
| apply(`Object obj`, `Object config`, `Object defaults`) : Object | Ext
* Copies all the properties of config to obj.
| applyIf(`Object obj`, `Object config`) : Object | Ext
Copies all the properties of config to obj if they don't already exist.
| decode() : void | Ext
Shorthand for Ext.util.JSON.decode
| each(`Array/NodeList/Mixed array`, `Function fn`, `Object scope`) : void | Ext
Iterates an array calling the passed function with each item, stopping if your function returns false. If the passed ...
| encode() : void | Ext
Shorthand for Ext.util.JSON.encode
| escapeRe(`String str`) : String | Ext
Escapes the passed string for use in a regular expression
| extend(`Object subclass`, `Object superclass`, [`Object overrides`]) : void | Ext
Extends one class with another class and optionally overrides members with the passed literal. This class also adds t...
| fly(`String/HTMLElement el`, [`String named`]) : Element | Ext
<static> Gets the globally shared flyweight Element, with the passed node as the active element. Do not store a...
| get(`String/HTMLElement/Element el`) : Element | Ext
Static method to retrieve Element objects. Uses simple caching to consistently return the same object. Automatically...
| getCmp(`String id`) : Ext.Component | Ext
Shorthand for Ext.ComponentMgr.get
| getDom(`String/HTMLElement/Element) el`) : HTMLElement | Ext
Return the dom node for the passed string (id), dom node, or Ext.Element
| id([`String/HTMLElement/Element el`], [`String prefix`]) : void | Ext
Generates unique ids. If the element already has an id, it is unchanged
| namespace(`String namespace1`, `String namespace2`, `String etc`) : void | Ext
Creates namespaces but does not assume YAHOO is the root.
| onReady(`Function fn`, `Object scope`, `boolean override`) : void | Ext
Fires when the document is ready (before onload and before images are loaded). Shorthand of Ext.EventManager.onDocum...
| query(`String path`, [`Node root`]) : Array | Ext
Selects an array of DOM nodes by CSS/XPath selector. Shorthand of Ext.DomQuery.select
| select(`String/Array selector`, [`Boolean unique`]) : CompositeElementLite/CompositeElement | Ext
Selects elements based on the passed CSS selector to enable working on them as 1.
| urlDecode(`String string`, [`Boolean overwrite`]) : Object | Ext
Takes an encoded URL and and converts it to an object. e.g. Ext.urlDecode("foo=1&bar=2"); would return {foo: 1, bar: ...
| urlEncode(`Object o`) : String | Ext
Takes an object and converts it to an encoded URL. e.g. Ext.urlEncode({foo: 1, bar: 2}); would return "foo=1&bar=2". ...

## Public Events

This class has no public events.

## Property Details

### BLANK_IMAGE_URL

`public String BLANK_IMAGE_URL`
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).
This property is defined by Ext.

### SSL_SECURE_URL

`public String SSL_SECURE_URL`
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).
This property is defined by Ext.

### isReady

`public Boolean isReady`
True when the document is fully initialized and ready for action
This property is defined by Ext.

### isSecure

`public Boolean isSecure`
True if the page is running over SSL
This property is defined by Ext.

### isStrict

`public Boolean isStrict`
True if the browser is in strict mode
This property is defined by Ext.

### useShims

`public Boolean useShims`
By default, Ext intelligently decides whether floating elements should be shimmed. If you are using flash, you may want to set this to true.
This property is defined by Ext.

## Method Details

### addBehaviors

`public function addBehaviors(`Object obj`)`
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`

This method is defined by Ext.

### apply

`public function apply(`Object obj`, `Object config`, `Object defaults`)`
* 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

This method is defined by Ext.

### applyIf

`public function applyIf(`Object obj`, `Object config`)`
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

This method is defined by Ext.

### decode

`public function decode()`
Shorthand for Ext.util.JSON.decode
Parameters:

- None.

Returns:

- `void`

This method is defined by Ext.

### each

`public function each(`Array/NodeList/Mixed array`, `Function fn`, `Object scope`)`
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`

This method is defined by Ext.

### encode

`public function encode()`
Shorthand for Ext.util.JSON.encode
Parameters:

- None.

Returns:

- `void`

This method is defined by Ext.

### escapeRe

`public function escapeRe(`String str`)`
Escapes the passed string for use in a regular expression
Parameters:

- `str` : String

Returns:

- `String`

This method is defined by Ext.

### extend

`public function extend(`Object subclass`, `Object superclass`, [`Object overrides`])`
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.
Parameters:

- `subclass` : Object
  The class inheriting the functionality
- `superclass` : Object
  The class being extended
- `overrides` : Object
  (optional) A literal with members

Returns:

- `void`

This method is defined by Ext.

### fly

`public function fly(`String/HTMLElement el`, [`String named`])`
<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

This method is defined by Ext.

### get

`public function get(`String/HTMLElement/Element el`)`
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` : String/HTMLElement/Element
  The id of the node, a DOM Node or an existing Element.

Returns:

- `Element`
  The Element object

This method is defined by Ext.

### getCmp

`public function getCmp(`String id`)`
Shorthand for Ext.ComponentMgr.get
Parameters:

- `id` : String

Returns:

- `Ext.Component`

This method is defined by Ext.

### getDom

`public function getDom(`String/HTMLElement/Element) el`)`
Return the dom node for the passed string (id), dom node, or Ext.Element
Parameters:

- `el` : String/HTMLElement/Element)

Returns:

- `HTMLElement`

This method is defined by Ext.

### id

`public function id([`String/HTMLElement/Element el`], [`String prefix`])`
Generates unique ids. If the element already has an id, it is unchanged
Parameters:

- `el` : String/HTMLElement/Element
  (optional) The element to generate an id for
- `prefix` : String
  (optional) Id prefix (defaults "ext-gen")

Returns:

- `void`

This method is defined by Ext.

### namespace

`public function namespace(`String namespace1`, `String namespace2`, `String etc`)`
Creates namespaces but does not assume YAHOO is the root.
Parameters:

- `namespace1` : String
- `namespace2` : String
- `etc` : String

Returns:

- `void`

This method is defined by Ext.

### onReady

`public function onReady(`Function fn`, `Object scope`, `boolean override`)`
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`

This method is defined by Ext.

### query

`public function query(`String path`, [`Node root`])`
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`

This method is defined by Ext.

### select

`public function select(`String/Array selector`, [`Boolean unique`])`
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)

Returns:

- `CompositeElementLite/CompositeElement`

This method is defined by Ext.

### urlDecode

`public function urlDecode(`String string`, [`Boolean overwrite`])`
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

This method is defined by Ext.

### urlEncode

`public function urlEncode(`Object o`)`
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`

This method is defined by Ext.

Ext - Copyright © 2006-2007 Ext JS, LLC
All rights reserved.