Ext
Files
Ext core utilities and functions.
Available since: 1.1.0
Properties
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 ('about:blank', except for IE in secure mode, which is 'javascript:""').
Available since: 1.1.0
True to automatically uncache orphaned Ext.Elements periodically (defaults to true)
Defaults to: true
Available since: 1.1.0
True to automatically purge event listeners during garbageCollection (defaults to true).
Defaults to: true
Available since: 1.1.0
True when the document is fully initialized and ready for action
Defaults to: false
Available since: 1.1.0
True if the page is running over SSL
True if the page is running over SSL
Available since: 1.1.0
The version of the framework
Defaults to: '1.1.1'
Available since: 1.1.0
Methods
Creates meta tags for a given config object. This is usually just called internally from Ext.setup - see that method for full usage. Extracted into its own function so that Ext.Application and other classes can call it without invoking all of the logic inside Ext.setup.
Available since: 1.1.0
Parameters
- config : Object
The meta tag configuration object
Copies all the properties of config to obj. apply
Available since: 1.1.0
Parameters
- object : 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
Copies all the properties of config to obj if they don't already exist.
Available since: 1.1.0
Parameters
- obj : Object
The receiver of the properties
- config : Object
The source of the properties
Returns
- Object
returns obj
Shorthand for Ext.ComponentMgr.create Creates a new Component from the specified config object using the config object's xtype to determine the class to instantiate.
Available since: 1.1.0
Parameters
- config : Object
A configuration object for the Component you wish to create.
- defaultType : Constructor
The constructor to provide the default Component type if the config object does not contain a
xtype. (Optional if the config contains axtype).
Returns
- Ext.Component
The newly instantiated Component.
Shorthand for Ext.util.Functions.createDelegate
Available since: Touch 1.1.1
Parameters
- fn : Function
The function to delegate.
- scope : Object (optional)
The scope (
thisreference) in which the function is executed. If omitted, defaults to the browser window. - args : Array (optional)
Overrides arguments for the call. (Defaults to the arguments passed by the caller)
- appendArgs : Boolean/Number (optional)
if True args are appended to call args instead of overriding, if a number the args are inserted at the specified position
Returns
- Function
The new function
Shorthand for Ext.util.Functions.createInterceptor
Available since: Touch 1.1.1
Parameters
- origFn : Function
The original function.
- newFn : Function
The function to call before the original
- scope : Object (optional)
The scope (
thisreference) in which the passed function is executed. If omitted, defaults to the scope in which the original function is called or the browser window.
Returns
- Function
The new function
Shorthand for Ext.util.Functions.createSequence
Available since: Touch 1.1.1
Parameters
- origFn : Function
The original function.
- newFn : Function
The function to sequence
- scope : Object (optional)
The scope (this reference) in which the passed function is executed. If omitted, defaults to the scope in which the original function is called or the browser window.
Returns
- Function
The new function
Shorthand for Ext.util.JSON.decode
Available since: 1.1.0
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
Shorthand for Ext.util.Functions.defer
Available since: 1.1.0
Parameters
- fn : Function
The function to defer.
- millis : Number
The number of milliseconds for the setTimeout call (if less than or equal to 0 the function is executed immediately)
- scope : Object (optional)
The scope (
thisreference) in which the function is executed. If omitted, defaults to the browser window. - args : Array (optional)
Overrides arguments for the call. (Defaults to the arguments passed by the caller)
- appendArgs : Boolean/Number (optional)
if True args are appended to call args instead of overriding, if a number the args are inserted at the specified position
Returns
- Number
The timeout id that can be used with clearTimeout
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.
Available since: 1.1.0
Parameters
- args : Object...
An Ext.Element, Ext.Component, or an Array of either of these to destroy
Shorthand for Ext.Dispatcher.dispatch. Dispatches a request to a controller action
Available since: 1.1.0
Iterates an array calling the supplied function.
Available since: 1.1.0
Parameters
- array : Array/NodeList/Mixed
The array to be iterated. If this argument is not really an array, the supplied function is called once.
- fn : Function
The function to be called with each item. If the supplied function returns false, iteration stops and this method returns the current
index. This function is called with the following arguments:item: MixedThe item at the currentindexin the passedarrayindex: NumberThe current index within the arrayallItems: ArrayThearraypassed as the first argument toExt.each.
- scope : Object
The scope (
thisreference) in which the specified function is executed. Defaults to theitemat the currentindexutil within the passedarray.
Returns
- Object
See description for the fn parameter.
Shorthand for Ext.util.JSON.encode
Available since: 1.1.0
Parameters
- o : Mixed
The variable to encode
Returns
- String
The JSON string
Extends one class to create a subclass and optionally overrides members with the passed literal. This method also adds the function "override()" to the subclass that can be used to override members of the class.
For example, to create a subclass of Ext GridPanel:
MyGridPanel = Ext.extend(Ext.grid.GridPanel, {
constructor: function(config) {
// Create configuration for this Grid.
var store = new Ext.data.Store({...});
var colModel = new Ext.grid.ColumnModel({...});
// Create a new config object containing our computed properties
// *plus* whatever was in the config parameter.
config = Ext.apply({
store: store,
colModel: colModel
}, config);
MyGridPanel.superclass.constructor.call(this, config);
// Your postprocessing here
},
yourMethod: function() {
// etc.
}
});
This function also supports a 3-argument call in which the subclass's constructor is passed as an argument. In this form, the parameters are as follows:
subclass: FunctionThe subclass constructor.superclass: FunctionThe constructor of class being extendedoverrides: ObjectA literal with members which are copied into the subclass's prototype, and are therefore shared among all instances of the new class.
Available since: 1.1.0
Parameters
- superclass : Function
The constructor of class being extended.
- overrides : Object
A literal with members which are copied into the subclass's prototype, and are therefore shared between 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.
It is essential that you call the superclass constructor in any provided constructor. See example code.
Returns
- Function
The subclass constructor from the
overridesparameter, or a generated one if not provided.
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 get will be more appropriate to take advantage of the caching provided by the Ext.Element class.
Available since: 1.1.0
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)
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
Available since: 1.1.0
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)
Returns the current document body as an Ext.Element.
Available since: 1.1.0
Returns
- Object
Ext.Element The document body
This is shorthand reference to Ext.ComponentMgr.get. Looks up an existing Component by id
Available since: 1.1.0
Parameters
- id : String
The component id
Returns
- Object
Ext.Component The Component, undefined if not found, or null if a Class was found.
Returns the current HTML document object as an Ext.Element.
Available since: 1.1.0
Returns
- Object
Ext.Element The document
Return the dom node for the passed String (id), dom node, or Ext.Element. Here are some examples:
// gets dom node based on id
var elDom = Ext.getDom('elId');
// gets dom node based on the dom node
var elDom1 = Ext.getDom(elDom);
// If we don't know if we are working with an
// Ext.Element or a dom node use Ext.getDom
function(el){
var dom = Ext.getDom(el);
// do something with the dom node
}
Note: the dom node to be found actually needs to exist (be rendered, etc) when this method is called to be successful.
Available since: 1.1.0
Parameters
- el : Mixed
Returns
- Object
HTMLElement
Returns the current document head as an Ext.Element.
Available since: 1.1.0
Returns
- Object
Ext.Element The document head
Returns the current orientation of the mobile device
Available since: 1.1.0
Returns
- String
Either 'portrait' or 'landscape'
Gets a registered Store by id (shortcut to lookup)
Available since: 1.1.0
Parameters
- id : String/Object
The id of the Store, or a Store instance
Returns
Convert certain characters (&, <, >, and ') from their HTML character equivalents.
Available since: 1.1.0
Parameters
- value : String
The string to decode
Returns
- String
The decoded text
Convert certain characters (&, <, >, and ') to their HTML character equivalents for literal display in web pages.
Available since: 1.1.0
Parameters
- value : String
The string to encode
Returns
- String
The encoded text
Generates unique ids. If the element already has an id, it is unchanged
Available since: 1.1.0
Parameters
- el : Mixed (optional)
The element to generate an id for
- prefix : String (optional)
Id prefix (defaults "ext-gen")
Returns
- String
The generated Id.
Returns true if the passed value is a JavaScript array, otherwise false.
Available since: 1.1.0
Parameters
- value : Mixed
The value to test
Returns
- Boolean
util Returns true if the passed value is a boolean.
Available since: 1.1.0
Parameters
- value : Mixed
The value to test
Returns
- Boolean
Returns true if the passed object is a JavaScript date object, otherwise false.
Available since: 1.1.0
Parameters
- object : Object
The object to test
Returns
- Boolean
Returns true if the passed value is not undefined.
Available since: 1.1.0
Parameters
- value : Mixed
The value to test
Returns
- Boolean
Returns true if the passed value is an HTMLElement
Available since: 1.1.0
Parameters
- value : Mixed
The value to test
Returns
- Boolean
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)
Available since: 1.1.0
Parameters
- value : Mixed
The value to test
- allowBlank : Boolean (optional)
true to allow empty strings (defaults to false)
Returns
- Boolean
Returns true if the passed value is a JavaScript Function, otherwise false.
Available since: 1.1.0
Parameters
- value : Mixed
The value to test
Returns
- Boolean
Returns true if the passed value is a number. Returns false for non-finite numbers.
Available since: 1.1.0
Parameters
- value : Mixed
The value to test
Returns
- Boolean
Returns true if the passed value is a JavaScript Object, otherwise false.
Available since: 1.1.0
Parameters
- value : Mixed
The value to test
Returns
- Boolean
Returns true if the passed value is a JavaScript 'primitive', a string, number or boolean.
Available since: 1.1.0
Parameters
- value : Mixed
The value to test
Returns
- Boolean
Returns true if the passed value is a string.
Available since: 1.1.0
Parameters
- value : Mixed
The value to test
Returns
- Boolean
Iterates either the elements in an array, or each of the properties in an object. Note: If you are only iterating arrays, it is better to call each.
Available since: 1.1.0
Parameters
- object : Object/Array
The object or array to be iterated
- fn : Function
The function to be called for each iteration. The iteration will stop if the supplied function returns false, or all array elements / object properties have been covered. The signature varies depending on the type of object being interated:
- Arrays : (Object item, Number index, Array allItems)
When iterating an array, the supplied function is called with each item.
- Objects : (String key, Object value, Object)
When iterating an object, the supplied function is called with each key-value pair in the object, and the iterated object
- scope : Object
The scope (
thisreference) in which the specified function is executed. Defaults to theobjectbeing iterated. - Arrays : (Object item, Number index, Array allItems)
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) { ... }
Available since: 1.1.0
Parameters
- namespace1 : String
- namespace2 : String
- etc : String
Returns
- Object
The namespace object. (If multiple arguments are passed, this will be the last namespace created)
Utility method for validating that a value is numeric, returning the specified default value if it is not.
Available since: 1.1.0
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
Adds a listener to be notified when the document is ready (before onload and before images are loaded). Shorthand of Ext.EventManager.onDocumentReady.
Available since: 1.1.0
Parameters
- fn : Function
The method the event invokes.
- scope : Object (optional)
The scope (
thisreference) in which the handler function executes. Defaults to the browser window. - options : boolean (optional)
Options object as passed to Ext.Element.addListener. It is recommended that the options
{single: true}be used so that the handler is removed on first invocation.
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.
}
});
Available since: 1.1.0
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.
Plucks the value of a property from each item in the Array
// Example: Ext.pluck(Ext.query("p"), "className"); // [el1.className, el2.className, ..., elN.className]
Available since: 1.1.0
Parameters
- arr : Array|NodeList
The Array of items to pluck the value from.
- prop : String
The property name to pluck from each element.
Returns
- Array
The value from each item in the Array.
Shorthand for Ext.PluginMgr.registerType
Available since: 1.1.0
Parameters
- ptype : String
The mnemonic string by which the Plugin class may be looked up.
- cls : Constructor
The new Plugin class.
Shorthand for Ext.Dispatcher.redirect. Dispatches a request to a controller action, adding to the History stack and updating the page url as necessary.
Available since: 1.1.0
Shorthand for Ext.ComponentMgr.registerType
Available since: 1.1.0
Parameters
- xtype : String
The mnemonic string by which the Component class may be looked up.
- cls : Constructor
The new Component class.
Shorthand for Ext.ApplicationManager.register Creates a new Application class from the specified config object. See Ext.Application for full examples.
Available since: 1.1.0
Parameters
- config : Object
A configuration object for the Model you wish to create.
Returns
- Ext.Application
The newly created Application
Shorthand for Ext.ControllerMgr.register Creates a new Controller class from the specified config object. See Ext.Controller for full examples.
Available since: 1.1.0
Parameters
- config : Object
A configuration object for the Controller you wish to create.
Returns
- Ext.Controller
The newly registered Controller
Shorthand for Ext.layout.LayoutManager.registerType
Available since: 1.1.0
Parameters
- type : String
The mnemonic string by which the Layout class may be looked up.
- cls : Constructor
The new Layout class.
Shorthand for Ext.ModelMgr.registerType Creates a new Model class from the specified config object. See Ext.data.Model for full examples.
Available since: 1.1.0
Parameters
- config : Object
A configuration object for the Model you wish to create.
Returns
- Ext.data.Model
The newly registered Model
Creates a new store for the given id and config, then registers it with the Store Mananger. Sample usage:
Ext.regStore('AllUsers', {
model: 'User'
});
//the store can now easily be used throughout the application
new Ext.List({
store: 'AllUsers',
... other config
});
Available since: 1.1.0
Parameters
- id : String
The id to set on the new store
- config : Object
The store config
- cls : Constructor
The new Component class.
Removes this element from the document, removes all DOM event listeners, and deletes the cache reference.
All DOM event listeners are removed from this element. If enableNestedListenerRemoval is
true, then DOM event listeners are also removed from all child nodes. The body node
will be ignored if passed in.
Available since: 1.1.0
Parameters
- node : HTMLElement
The node to remove
Repaints the whole page. This fixes frequently encountered painting issues in mobile Safari.
Available since: 1.1.0
Selects elements based on the passed CSS selector to enable Element methods to be applied to many related elements in one statement through the returned CompositeElement or CompositeElement object.
Available since: 1.1.0
Parameters
- selector : String/Array
The CSS selector or an array of elements
- root : HTMLElement/String (optional)
The root element of the query or id of the root
Returns
- CompositeElement
Sets up a page for use on a mobile device.
Available since: 1.1.0
Parameters
- config : Object
Valid configurations are:
- fullscreen - Boolean - Sets an appropriate meta tag for Apple devices to run in full-screen mode.
- tabletStartupScreen - String - Startup screen to be used on an iPad. The image must be 768x1004 and in portrait orientation.
- phoneStartupScreen - String - Startup screen to be used on an iPhone or iPod touch. The image must be 320x460 and in portrait orientation.
- icon - Default icon to use. This will automatically apply to both tablets and phones. These should be 72x72.
- tabletIcon - String - An icon for only tablets. (This config supersedes icon.) These should be 72x72.
- phoneIcon - String - An icon for only phones. (This config supersedes icon.) These should be 57x57.
- glossOnIcon - Boolean - Add gloss on icon on iPhone, iPad and iPod Touch
- statusBarStyle - String - Sets the status bar style for fullscreen iPhone OS web apps. Valid options are default, black, or black-translucent.
- onReady - Function - Function to be run when the DOM is ready.
- scope - Scope - Scope for the onReady configuraiton to be run in.
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];
Available since: 1.1.0
Parameters
- array : Iterable
the iterable object to be turned into a true Array.
- start : Number
a number that specifies where to start the selection.
- end : Number
a number that specifies where to end the selection.
Returns
- Object
(Array) array
Appends content to the query string of a URL, handling logic for whether to place a question mark or ampersand.
Available since: 1.1.0
Parameters
- url : String
The URL to append to.
- s : String
The content to append to the URL.
Returns
- Object
(String) The resulting URL
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"]}
Available since: 1.1.0
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
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.
Available since: 1.1.0
Parameters
- o : Object
The object to encode
- pre : String (optional)
A prefix to add to the url encoded string
Returns
- String