Print Friendly

Class Ext

Package:Global
Class:Ext
Extends:Object
Defined In:Ext.js
Ext core utilities 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...
  enableGarbageCollector : Boolean Ext
True to automatically uncache orphaned Ext.Elements periodically (defaults to true)
  enableListenerCollection : Boolean Ext
True to automatically purge event listeners after uncaching an element (defaults to false). Note: this only happens i...
  isBorderBox : Boolean Ext
  isGecko : Boolean Ext
  isIE : Boolean Ext
  isIE7 : Boolean Ext
  isLinux : Boolean Ext
  isMac : Boolean Ext
  isOpera : Boolean Ext
  isReady : Boolean Ext
True when the document is fully initialized and ready for action
  isSafari : Boolean Ext
  isSecure : Boolean Ext
True if the page is running over SSL
  isStrict : Boolean Ext
True if the browser is in strict mode
  isWindows : Boolean Ext
  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
  addBehaviorsObject obj ) : void Ext
Applies event listeners to elements by selectors when the document is ready. The event name is specified with an @ su...
  applyObject obj, Object config, Object defaults ) : Object Ext
Copies all the properties of config to obj.
  applyIfObject 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
  eachArray/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
  escapeReString str ) : String Ext
Escapes the passed string for use in a regular expression
  extendObject 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...
  flyString/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...
  getString/HTMLElement/Element el ) : Element Ext
Static method to retrieve Element objects. Uses simple caching to consistently return the same object. Automatically ...
  getCmpString id ) : Ext.Component Ext
Shorthand for Ext.ComponentMgr.get
  getDomString/HTMLElement/Ext.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] ) : String Ext
Generates unique ids. If the element already has an id, it is unchanged
  isEmptyMixed value, [Boolean allowBlank] ) : Boolean Ext
Returns true if the passed value is null, undefined or an empty string (optional).
  namespaceString namespace1, String namespace2, String etc ) : void Ext
Creates namespaces but does not assume YAHOO is the root.
  onReadyFunction 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...
  overrideObject origclass, Object overrides ) : void Ext
Adds a list of functions to the prototype of an existing class, overwriting any existing methods with the same name. ...
  queryString path, [Node root] ) : Array Ext
Selects an array of DOM nodes by CSS/XPath selector. Shorthand of Ext.DomQuery.select
  selectString/Array selector, [Boolean unique], [HTMLElement/String root] ) : CompositeElementLite/CompositeElement Ext
Selects elements based on the passed CSS selector to enable working on them as 1.
  typeMixed object ) : String Ext
Returns the type of object that is passed in. If the object passed in is null or undefined it return false otherwise ...
  urlDecodeString 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: ...
  urlEncodeObject 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.

enableGarbageCollector

public Boolean enableGarbageCollector
True to automatically uncache orphaned Ext.Elements periodically (defaults to true)
This property is defined by Ext.

enableListenerCollection

public Boolean enableListenerCollection
True to automatically purge event listeners after uncaching an element (defaults to false). Note: this only happens if enableGarbageCollector is true.
This property is defined by Ext.

isBorderBox

public Boolean isBorderBox
This property is defined by Ext.

isGecko

public Boolean isGecko
This property is defined by Ext.

isIE

public Boolean isIE
This property is defined by Ext.

isIE7

public Boolean isIE7
This property is defined by Ext.

isLinux

public Boolean isLinux
This property is defined by Ext.

isMac

public Boolean isMac
This property is defined by Ext.

isOpera

public Boolean isOpera
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.

isSafari

public Boolean isSafari
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.

isWindows

public Boolean isWindows
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/Ext.Element el )
Return the dom node for the passed string (id), dom node, or Ext.Element
Parameters:
  • el : String/HTMLElement/Ext.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:
  • String
    The generated Id.
This method is defined by Ext.

isEmpty

public function isEmpty( Mixed value, [Boolean allowBlank] )
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
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.

override

public function override( Object origclass, Object overrides )
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
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], [HTMLElement/String root] )
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
This method is defined by Ext.

type

public function type( Mixed object )
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
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.