Ext
Files
The Ext namespace (global object) encapsulates all classes, singletons, and utility methods provided by Sencha's libraries.
Most user interface Components are at a lower level of nesting in the namespace, but many common utility functions are provided as direct properties of the Ext namespace.Also many frequently used methods from other classes are provided as shortcuts within the Ext namespace. For example Ext.getCmp aliases Ext.ComponentManager.get.
Many applications are initiated with Ext.onReady which is called once the DOM is ready. This ensures all scripts have been loaded, preventing dependency issues. For example
Ext.onReady(function(){
new Ext.Component({
renderTo: document.body,
html: 'DOM ready!'
});
});
For more information about how to use the Ext classes, see
Available since: 1.1.0
Properties
URL to a 1x1 transparent gif image used by Ext to create inline icons with CSS background images. In older versions of IE, this defaults to "http://sencha.com/s.gif" and you should change this to a URL on your server. For other browsers it uses an inline data URL.
Available since: 1.1.0
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
Indicates whether to use native browser parsing for JSON methods. This option is ignored if the browser does not support native JSON methods. Note: Native JSON methods will not work with objects that have functions. Also, property names must be quoted, otherwise the data will not parse. (Defaults to false)
Defaults to: false
Available since: 3.4.0
The current version of Chrome (0 if the browser is not Chrome).
The current version of Chrome (0 if the browser is not Chrome).
Available since: 4.0.5
True if the Ext.fx.Anim Class is available
True if the Ext.fx.Anim Class is available
Available since: 3.4.0
True to automatically uncache orphaned Ext.Elements periodically
Defaults to: true
Available since: 1.1.0
True to automatically purge event listeners during garbageCollection.
Defaults to: true
Available since: 1.1.0
EXPERIMENTAL - True to cascade listener removal to child elements when an element is removed. Currently not optimized for performance.
Defaults to: false
Available since: 3.4.0
An array containing extra enumerables for old browsers
An array containing extra enumerables for old browsers
Available since: 4.0.0
The current version of Firefox (0 if the browser is not Firefox).
The current version of Firefox (0 if the browser is not Firefox).
Available since: 4.0.5
The current version of IE (0 if the browser is not IE). This does not account for the documentMode of the current page, which is factored into isIE7, isIE8 and isIE9. Thus this is not always true:
Ext.isIE8 == (Ext.ieVersion == 8)
Available since: 4.0.5
True if the detected browser is Chrome.
True if the detected browser is Chrome.
Available since: 2.3.0
True if the detected browser uses FireFox 3.0
True if the detected browser uses FireFox 3.0
Available since: 4.0.0
True if the detected browser uses FireFox 3.5
True if the detected browser uses FireFox 3.5
Available since: 4.0.0
True if the detected browser uses FireFox 3.6
True if the detected browser uses FireFox 3.6
Available since: 4.0.0
True if the detected browser uses FireFox 4
True if the detected browser uses FireFox 4
Available since: 4.0.5
True if the detected browser uses FireFox 5
True if the detected browser uses FireFox 5
Available since: 4.0.5
True if the detected browser uses the Gecko layout engine (e.g. Mozilla, Firefox).
Available since: 1.1.0
True if the detected browser uses a Gecko 1.9+ layout engine (e.g. Firefox 3.x).
Available since: 1.1.0
True if the detected browser uses a Gecko 2.0+ layout engine (e.g. Firefox 4.x).
Available since: 4.0.0
True if the detected browser uses a Gecko 5.0+ layout engine (e.g. Firefox 5.x).
Available since: 4.0.5
True if the detected browser is Internet Explorer.
True if the detected browser is Internet Explorer.
Available since: 1.1.0
True if the detected browser is Internet Explorer 6.x.
True if the detected browser is Internet Explorer 6.x.
Available since: 1.1.0
True if the detected browser is Internet Explorer 7.x.
True if the detected browser is Internet Explorer 7.x.
Available since: 1.1.0
True if the detected browser is Internet Explorer 8.x.
True if the detected browser is Internet Explorer 8.x.
Available since: 2.3.0
True if the detected browser is Internet Explorer 9.x.
True if the detected browser is Internet Explorer 9.x.
Available since: 3.4.0
True if the detected platform is Linux.
True if the detected platform is Linux.
Available since: 1.1.0
True if the detected platform is Mac OS.
True if the detected platform is Mac OS.
Available since: 1.1.0
True if the detected browser is Opera.
True if the detected browser is Opera.
Available since: 1.1.0
True if the detected browser is Opera 10.5x.
True if the detected browser is Opera 10.5x.
Available since: 4.0.0
True when the document is fully initialized and ready for action
Defaults to: false
Available since: 1.1.0
True if the detected browser is Safari.
True if the detected browser is Safari.
Available since: 1.1.0
True if the detected browser is Safari 2.x.
True if the detected browser is Safari 2.x.
Available since: 1.1.0
True if the detected browser is Safari 3.x.
True if the detected browser is Safari 3.x.
Available since: 1.1.0
True if the detected browser is Safari 4.x.
True if the detected browser is Safari 4.x.
Available since: 2.3.0
True if the detected browser is Safari 5.x.
True if the detected browser is Safari 5.x.
Available since: 4.0.5
True if the detected browser uses WebKit.
True if the detected browser uses WebKit.
Available since: 2.3.0
True if the detected platform is Windows.
True if the detected platform is Windows.
Available since: 1.1.0
The current version of Opera (0 if the browser is not Opera).
The current version of Opera (0 if the browser is not Opera).
Available since: 4.0.5
The current version of Safari (0 if the browser is not Safari).
The current version of Safari (0 if the browser is not Safari).
Available since: 4.0.5
True to scope the reset CSS to be just applied to Ext components. Note that this wraps root containers with an additional element. Also remember that when you turn on this option, you have to use ext-all-scoped { unless you use the bootstrap.js to load your javascript, in which case it will be handled for you.
Available since: 4.0.0
By default, Ext intelligently decides whether floating elements should be shimmed. If you are using flash, you may want to set this to true.
Available since: 1.1.0
Methods
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
}
});
Available since: 1.1.0
Parameters
- obj : Object
The list of behaviors to apply
Loads Ext.app.Application class and starts it up with given configuration after the page is ready.
See Ext.app.Application for details.
Available since: 4.0.1
Parameters
- config : Object
Copies all the properties of config to the specified object. Note that if recursive merging and cloning without referencing the original objects / arrays is needed, use Ext.Object.merge instead.
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
Create a new function from the provided fn, change this to the provided scope, optionally
overrides arguments for the call. (Defaults to the arguments passed by the caller)
Ext.bind is alias for Ext.Function.bind
Available since: 4.0.0
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
Execute a callback function in a particular scope. If no function is passed the call is ignored.
For example, these lines are equivalent:
Ext.callback(myFunc, this, [arg1, arg2]);
Ext.isFunction(myFunc) && myFunc.apply(this, [arg1, arg2]);
Available since: 4.0.0
Parameters
Old alias to Ext.Array.clean
Filter through an array and remove empty item as defined in Ext.isEmpty
See Ext.Array.filter
This method has been deprecated since 4.0.0
Use Ext.Array.clean instead
Available since: 3.4.0
Parameters
- array : Array
Returns
- Array
results
Copies a set of named properties fom the source object to the destination object.
Example:
ImageComponent = Ext.extend(Ext.Component, {
initComponent: function() {
this.autoEl = { tag: 'img' };
MyComponent.superclass.initComponent.apply(this, arguments);
this.initialBox = Ext.copyTo({}, this.initialConfig, 'x,y,width,height');
}
});
Important note: To borrow class prototype methods, use Ext.Base.borrow instead.
Available since: 3.4.0
Parameters
- dest : Object
The destination object.
- source : Object
The source object.
- names : String/String[]
Either an Array of property names, or a comma-delimited list of property names to copy.
- usePrototypeKeys : Boolean (optional)
Defaults to false. Pass true to copy keys off of the prototype as well as the instance.
Returns
- Object
The modified object.
Instantiate a class by either full name, alias or alternate name.
If Ext.Loader is enabled and the class has not been defined yet, it will attempt to load the class via synchronous loading.
For example, all these three lines return the same result:
// alias
var window = Ext.ClassManager.instantiate('widget.window', { width: 600, height: 800, ... });
// alternate name
var window = Ext.ClassManager.instantiate('Ext.Window', { width: 600, height: 800, ... });
// full class name
var window = Ext.ClassManager.instantiate('Ext.window.Window', { width: 600, height: 800, ... });
Ext.create is alias for Ext.ClassManager.instantiate.
Available since: 3.4.0
Parameters
- name : String
- args : Object...
Additional arguments after the name will be passed to the class' constructor.
Returns
- Object
instance
Instantiate a class by its alias.
If Ext.Loader is enabled and the class has not been defined yet, it will attempt to load the class via synchronous loading.
var window = Ext.ClassManager.instantiateByAlias('widget.window', { width: 600, height: 800, ... });
Ext.createByAlias is alias for Ext.ClassManager.instantiateByAlias.
Available since: 4.0.0
Parameters
- alias : String
- args : Object...
Additional arguments after the alias will be passed to the class constructor.
Returns
- Object
instance
Old name for widget.
Convenient shorthand to create a widget by its xtype, also see Ext.ClassManager.instantiateByAlias
var button = Ext.widget('button'); // Equivalent to Ext.create('widget.button')
var panel = Ext.widget('panel'); // Equivalent to Ext.create('widget.panel')
This method has been deprecated since 4.0.0
Use widget instead.
Available since: 4.0.2
Parameters
Returns
- Object
widget instance
Shorthand for Ext.JSON.decode
Decodes (parses) a JSON string to an object. If the JSON is invalid, this function throws a SyntaxError unless the safe option is set.
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
Calls this function after the number of millseconds specified, optionally in a specific scope. Example usage:
var sayHi = function(name){
alert('Hi, ' + name);
}
// executes immediately:
sayHi('Fred');
// executes after 2 seconds:
Ext.Function.defer(sayHi, 2000, this, ['Fred']);
// this syntax is sometimes useful for deferring
// execution of an anonymous function:
Ext.Function.defer(function(){
alert('Anonymous');
}, 100);
Ext.defer is alias for Ext.Function.defer
Available since: 3.4.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
Defines a class.
Ext.define and Ext.ClassManager.create are almost aliases of each other, with the only exception that Ext.define allows definition of overrides. To avoid trouble, always use Ext.define.
Ext.define('My.awesome.Class', {
someProperty: 'something',
someMethod: function() { ... }
...
}, function() {
alert('Created!');
alert(this === My.awesome.Class); // alerts true
var myInstance = new this();
});
Available since: 3.4.0
Parameters
- className : String
The class name to create in string dot-namespaced format, for example:
My.very.awesome.Class,FeedViewer.plugin.CoolPager. It is highly recommended to follow this simple convention:- The root and the class name are 'CamelCased'
- Everything else is lower-cased
- data : Object
The key-value pairs of properties to apply to this class. Property names can be of any valid strings, except those in the reserved list below:
- self
- alias
- alternateClassName
- config
- extend
- inheritableStatics
- mixins
- override (only when using Ext.define)
- requires
- singleton
- statics
- uses
- createdFn : Function (optional)
callback to execute after the class is created, the execution scope of which (
this) will be the newly created class itself.
Returns
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
- arg1 : Ext.Element/Ext.Component/Ext.Element[]/Ext.Component[]...
An Ext.Element, Ext.Component, or an Array of either of these to destroy
Iterates an array or an iterable value and invoke the given callback function for each item.
var countries = ['Vietnam', 'Singapore', 'United States', 'Russia'];
Ext.Array.each(countries, function(name, index, countriesItSelf) {
console.log(name);
});
var sum = function() {
var sum = 0;
Ext.Array.each(arguments, function(value) {
sum += value;
});
return sum;
};
sum(1, 2, 3); // returns 6
The iteration can be stopped by returning false in the function callback.
Ext.Array.each(countries, function(name, index, countriesItSelf) {
if (name === 'Singapore') {
return false; // break here
}
});
Ext.each is alias for Ext.Array.each
Available since: 1.1.0
Parameters
- iterable : Array/NodeList/Object
The value to be iterated. If this argument is not iterable, the callback function is called once.
- fn : Function
The callback function. If it returns false, the iteration stops and this method returns the current
index.Parameters
- item : Object
The item at the current
indexin the passedarray - index : Number
The current
indexwithin thearray - allItems : Array
The
arrayitself which was passed as the first argument
Returns
- Boolean
Return false to stop iteration.
- item : Object
- scope : Object (optional)
The scope (
thisreference) in which the specified function is executed. - reverse : Boolean (optional)
Reverse the iteration order (loop from the end to the beginning) Defaults false
Returns
- Boolean
See description for the
fnparameter.
Shorthand for Ext.JSON.encode
Encodes an Object, Array or other value
Available since: 1.1.0
Parameters
- o : Object
The variable to encode
Returns
- String
The JSON string
Escapes the passed string for use in a regular expression
This method has been deprecated since 4.0.0
Use Ext.String.escapeRegex instead
Available since: 1.1.0
Parameters
- str : String
Returns
Explicitly exclude files from being loaded. Useful when used in conjunction with a broad include expression.
Can be chained with more require and exclude methods, e.g.:
Ext.exclude('Ext.data.*').require('*');
Ext.exclude('widget.button*').require('widget.*');
Ext.exclude is alias for Ext.Loader.exclude for convenience.
Available since: 4.0.0
Parameters
Returns
- Object
object contains
requiremethod for chaining
This method deprecated. Use Ext.define instead.
This method has been deprecated since 4.0.0
Use Ext.define instead
Available since: 1.1.0
Parameters
Returns
- Function
The subclass constructor from the overrides parameter, or a generated one if not provided.
Old alias to Ext.Array.flatten
Recursively flattens into 1-d Array. Injects Arrays inline.
This method has been deprecated since 4.0.0
Use Ext.Array.flatten instead
Available since: 3.4.0
Parameters
- array : Array
The array to flatten
Returns
- Array
The 1-d array.
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. fly is alias for 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.
Available since: 2.3.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
- Ext.Element
The shared Element object (or null if no matching element was found)
Retrieves Ext.Element objects. get is an alias for Ext.Element.get.
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.ComponentManager.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.
Available since: 1.1.0
Parameters
- el : String/HTMLElement/Ext.Element
The id of the node, a DOM Node or an existing Element.
Returns
- Ext.Element
The Element object (or null if no matching element was found)
Returns the current document body as an Ext.Element.
Available since: 2.3.0
Returns
- Object
Ext.Element The document body
Get the class of the provided object; returns null if it's not an instance of any class created with Ext.define.
var component = new Ext.Component();
Ext.ClassManager.getClass(component); // returns Ext.Component
Ext.getClass is alias for Ext.ClassManager.getClass.
Available since: 4.0.2
Parameters
- object : Object
Returns
- Ext.Class
class
Get the name of the class by its reference or its instance.
Ext.ClassManager.getName(Ext.Action); // returns "Ext.Action"
Ext.getClassName is alias for Ext.ClassManager.getName.
Available since: 4.0.0
Parameters
Returns
- String
className
This is shorthand reference to Ext.ComponentManager.get. Looks up an existing Component by id
Available since: 1.1.0
Parameters
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: 2.3.0
Returns
- Object
Ext.Element The document
Return the dom node for the passed String (id), dom node, or Ext.Element. Optional 'strict' flag is needed for IE since it can return 'name' and 'id' elements by using getElementById. 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 : String/HTMLElement/Ext.Element
Returns
- Object
HTMLElement
Returns the current document head as an Ext.Element.
Available since: 3.4.0
Returns
- Object
Ext.Element The document head
Returns the current orientation of the mobile device
Available since: 4.0.0
Returns
- String
Either 'portrait' or 'landscape'
Utility method for getting the width of the browser's vertical scrollbar. This can differ depending on operating system settings, such as the theme or font size.
This method is deprected in favor of getScrollbarSize.
This method has been deprecated
Available since: 3.4.0
Parameters
- force : Boolean (optional)
true to force a recalculation of the value.
Returns
- Number
The width of a vertical scrollbar.
Returns the size of the browser scrollbars. This can differ depending on operating system settings, such as the theme or font size.
Available since: 4.0.2
Parameters
- force : Boolean (optional)
true to force a recalculation of the value.
Returns
- Object
An object containing the width of a vertical scrollbar and the height of a horizontal scrollbar.
Shortcut to Ext.data.StoreManager.lookup.
Gets a registered Store by id
Available since: 4.0.0
Parameters
Returns
Generate a unique reference of Ext in the global scope, useful for sandboxing
Available since: 4.0.0
Generates unique ids. If the element already has an id, it is unchanged
Available since: 1.1.0
Parameters
- el : HTMLElement/Ext.Element (optional)
The element to generate an id for
- prefix : String (optional)
Id prefix (defaults "ext-gen")
Returns
- String
The generated Id.
Invokes a method on each item in an Array.
// Example:
Ext.invoke(Ext.query("p"), "getAttribute", "id");
// [el1.getAttribute("id"), el2.getAttribute("id"), ..., elN.getAttribute("id")]
This method has been deprecated since 4.0.0
Will be removed in the next major version
Available since: 3.4.0
Parameters
- arr : Array/NodeList
The Array of items to invoke the method on.
- methodName : String
The method name to invoke.
- args : Object...
Arguments to send into the method invocation.
Returns
- Array
The results of invoking the method on each item in the array.
Returns true if the passed value is empty, false otherwise. The value is deemed to be empty if it is either:
nullundefined- a zero-length array
- a zero-length string (Unless the
allowEmptyStringparameter is set totrue)
Available since: 1.1.0
Parameters
- value : Object
The value to test
- allowEmptyString : Boolean (optional)
true to allow empty strings (defaults to false)
Returns
Iterates either an array or an object. This method delegates to Ext.Array.each if the given value is iterable, and Ext.Object.each otherwise.
Available since: 3.4.0
Parameters
- object : Object/Array
The object or array to be iterated.
- fn : Function
The function to be called for each iteration. See and Ext.Array.each and Ext.Object.each for detailed lists of arguments passed to this function depending on the given object type that is being iterated.
- scope : Object (optional)
The scope (
thisreference) in which the specified function is executed. Defaults to the object being iterated itself.
Logs a message. If a console is present it will be used. On Opera, the method
"opera.postError" is called. In other cases, the message is logged to an array
"Ext.log.out". An attached debugger can watch this array and view the log. The
log buffer is limited to a maximum of "Ext.log.max" entries (defaults to 250).
The Ext.log.out array can also be written to a popup window by entering the
following in the URL bar (a "bookmarklet"):
javascript:void(Ext.log.show());
If additional parameters are passed, they are joined and appended to the message. A technique for tracing entry and exit of a function is this:
function foo () {
Ext.log({ indent: 1 }, '>> foo');
// log statements in here or methods called from here will be indented
// by one step
Ext.log({ outdent: 1 }, '<< foo');
}
This method does nothing in a release build.
Available since: 4.0.1
Parameters
- message : String/Object
The message to log or an options object with any of the following properties:
msg: The message to log (required).level: One of: "error", "warn", "info" or "log" (the default is "log").dump: An object to dump to the log as part of the message.stack: True to include a stack trace in the log.indent: Cause subsequent log statements to be indented one step.outdent: Cause this and following statements to be one step less indented.
Old alias to Ext.Array.max
Returns the maximum value in the Array.
This method has been deprecated since 4.0.0
Use Ext.Array.max instead
Available since: 3.4.0
Parameters
- array : Array/NodeList
The Array from which to select the maximum value.
- comparisonFn : Function (optional)
a function to perform the comparision which determines maximization. If omitted the ">" operator will be used. Note: gt = 1; eq = 0; lt = -1
Returns
- Object
maxValue The maximum value
Old alias to Ext.Array.mean
Calculates the mean of all items in the array.
This method has been deprecated since 4.0.0
Use Ext.Array.mean instead
Available since: 3.4.0
Parameters
- array : Array
The Array to calculate the mean value of.
Returns
- Number
The mean.
A convenient alias method for Ext.Object.merge.
Merges any number of objects recursively without referencing them or their children.
var extjs = {
companyName: 'Ext JS',
products: ['Ext JS', 'Ext GWT', 'Ext Designer'],
isSuperCool: true
office: {
size: 2000,
location: 'Palo Alto',
isFun: true
}
};
var newStuff = {
companyName: 'Sencha Inc.',
products: ['Ext JS', 'Ext GWT', 'Ext Designer', 'Sencha Touch', 'Sencha Animator'],
office: {
size: 40000,
location: 'Redwood City'
}
};
var sencha = Ext.Object.merge(extjs, newStuff);
// extjs and sencha then equals to
{
companyName: 'Sencha Inc.',
products: ['Ext JS', 'Ext GWT', 'Ext Designer', 'Sencha Touch', 'Sencha Animator'],
isSuperCool: true
office: {
size: 30000,
location: 'Redwood City'
isFun: true
}
}
Available since: 4.0.0
Parameters
- object : Object...
Any number of objects to merge.
Returns
- Object
merged The object that is created as a result of merging all the objects passed in.
Old alias to Ext.Array.min
Returns the minimum value in the Array.
This method has been deprecated since 4.0.0
Use Ext.Array.min instead
Available since: 3.4.0
Parameters
- array : Array/NodeList
The Array from which to select the minimum value.
- comparisonFn : Function (optional)
a function to perform the comparision which determines minimization. If omitted the "<" operator will be used. Note: gt = 1; eq = 0; lt = -1
Returns
- Object
minValue The minimum value
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');
// equivalent and preferable to the above syntax
Ext.namespace('Company.data');
Company.Widget = function() { ... };
Company.data.CustomStore = function(config) { ... };
Available since: 1.1.0
Parameters
Returns
- Object
The namespace object. (If multiple arguments are passed, this will be the last namespace created)
Convenient alias for Ext.namespace
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');
// equivalent and preferable to the above syntax
Ext.namespace('Company.data');
Company.Widget = function() { ... };
Company.data.CustomStore = function(config) { ... };
Available since: 3.4.0
Parameters
Returns
- Object
The namespace object. (If multiple arguments are passed, this will be the last namespace created)
Validate that a value is numeric and convert it to a number if necessary. Returns the specified default value if it is not.
Ext.Number.from('1.23', 1); // returns 1.23 Ext.Number.from('abc', 1); // returns 1
This method has been deprecated since 4.0.0
Please use Ext.Number.from instead.
Available since: 1.1.0
Parameters
Returns
- Number
value, if numeric, defaultValue otherwise
Alias for Ext.EventManager.onDocumentReady
Available since: 4.0.0
Adds new listener to be executed when all required scripts are fully loaded.
Available since: 1.1.0
Parameters
Proxy to Ext.Base.override. Please refer Ext.Base.override for further details.
Ext.define('My.cool.Class', {
sayHi: function() {
alert('Hi!');
}
}
Ext.override(My.cool.Class, {
sayHi: function() {
alert('About to say...');
this.callOverridden();
}
});
var cool = new My.cool.Class();
cool.sayHi(); // alerts 'About to say...'
// alerts 'Hi!'
Please note that this.callOverridden() only works if the class was previously
created with {@link Ext.define)
Available since: 1.1.0
Parameters
Partitions the set into two sets: a true set and a false set. Example: Example2:
// Example 1:
Ext.partition([true, false, true, true, false]); // [[true, true, true], [false, false]]
// Example 2:
Ext.partition(
Ext.query("p"),
function(val){
return val.className == "class1"
}
);
// true are those paragraph elements with a className of "class1",
// false set are those that do not have that className.
This method has been deprecated since 4.0.0
Will be removed in the next major version
Available since: 3.4.0
Parameters
- arr : Array/NodeList
The array to partition
- truth : Function (optional)
a function to determine truth. If this is omitted the element itself must be able to be evaluated for its truthfulness.
Returns
- Array
[array of truish values, array of falsy values]
Create a new function from the provided fn, the arguments of which are pre-set to args.
New arguments passed to the newly created callback when it's invoked are appended after the pre-set ones.
This is especially useful when creating callbacks.
For example:
var originalFunction = function(){
alert(Ext.Array.from(arguments).join(' '));
};
var callback = Ext.Function.pass(originalFunction, ['Hello', 'World']);
callback(); // alerts 'Hello World'
callback('by Me'); // alerts 'Hello World by Me'
Ext.pass is alias for Ext.Function.pass
Available since: 4.0.0
Parameters
- fn : Function
The original function
- args : Array
The arguments to pass to new callback
- scope : Object (optional)
The scope (
thisreference) in which the function is executed.
Returns
- Function
The new callback function
Old alias to Ext.Array.pluck
Plucks the value of a property from each item in the Array. Example:
Ext.Array.pluck(Ext.query("p"), "className"); // [el1.className, el2.className, ..., elN.className]
This method has been deprecated since 4.0.0
Use Ext.Array.pluck instead
Available since: 3.4.0
Parameters
- array : Array/NodeList
The Array of items to pluck the value from.
- propertyName : String
The property name to pluck from each element.
Returns
- Array
The value from each item in the Array.
Shorthand of Ext.DomQuery.select
Selects an array of DOM nodes by CSS/XPath selector.
Uses document.querySelectorAll if browser supports that, otherwise falls back to Ext.DomQuery.jsSelect to do the work.
Aliased as query.
Available since: 1.1.0
Parameters
- path : String
The selector/xpath query
- root : HTMLElement (optional)
The start of the query (defaults to document).
Returns
- HTMLElement[]
An array of DOM elements (not a NodeList as returned by
querySelectorAll). Empty array when no matches.
Old way for creating Model classes. Instead use:
Ext.define("MyModel", {
extend: "Ext.data.Model",
fields: []
});
This method has been deprecated since 4.0.0
Use define instead.
Available since: 4.0.0
Parameters
- name : String
Name of the Model class.
- 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: 4.0.0
Parameters
Removes a DOM node from the document.
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 Ext.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: 2.3.0
Parameters
- node : HTMLElement
The node to remove
Loads all classes by the given names and all their direct dependencies; optionally executes the given callback function when finishes, within the optional scope.
Ext.require is alias for Ext.Loader.require for convenience.
Available since: 4.0.0
Parameters
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 CompositeElementLite object.
Available since: 1.1.0
Parameters
- selector : String/HTMLElement[]
The CSS selector or an array of elements
- root : HTMLElement/String (optional)
The root element of the query or id of the root
Returns
Old alias to Ext.Array.sum
Calculates the sum of all items in the given array.
This method has been deprecated since 4.0.0
Use Ext.Array.sum instead
Available since: 3.4.0
Parameters
- array : Array
The Array to calculate the sum value of.
Returns
- Number
The sum.
Synchronously loads all classes by the given names and all their direct dependencies; optionally executes the given callback function when finishes, within the optional scope.
Ext.syncRequire is alias for Ext.Loader.syncRequire for convenience.
Available since: 4.0.0
Parameters
Converts any iterable (numeric indices and a length property) into a true array.
function test() {
var args = Ext.Array.toArray(arguments),
fromSecondToLastArgs = Ext.Array.toArray(arguments, 1);
alert(args.join(' '));
alert(fromSecondToLastArgs.join(' '));
}
test('just', 'testing', 'here'); // alerts 'just testing here';
// alerts 'testing here';
Ext.Array.toArray(document.getElementsByTagName('div')); // will convert the NodeList into an array
Ext.Array.toArray('splitted'); // returns ['s', 'p', 'l', 'i', 't', 't', 'e', 'd']
Ext.Array.toArray('splitted', 0, 3); // returns ['s', 'p', 'l', 'i']
Ext.toArray is alias for Ext.Array.toArray
Available since: 3.4.0
Parameters
- iterable : Object
the iterable object to be turned into a true Array.
- start : Number (optional)
a zero-based index that specifies the start of extraction. Defaults to 0
- end : Number (optional)
a zero-based index that specifies the end of extraction. Defaults to the last index of the iterable value
Returns
- Array
array
Turns an array into a sentence, joined by a specified connector - e.g.: Ext.toSentence(['Adama', 'Tigh', 'Roslin']); //'Adama, Tigh and Roslin' Ext.toSentence(['Adama', 'Tigh', 'Roslin'], 'or'); //'Adama, Tigh or Roslin'
This method has been deprecated since 4.0.0
Will be removed in the next major version
Available since: 4.0.0
Parameters
- items : String[]
The array to create a sentence from
- connector : String
The string to use to connect the last two words. Usually 'and' or 'or' - defaults to 'and'.
Returns
- String
The sentence string
Old alias to typeOf
Returns the type of the given variable in string format. List of possible values are:
undefined: If the given value isundefinednull: If the given value isnullstring: If the given value is a stringnumber: If the given value is a numberboolean: If the given value is a boolean valuedate: If the given value is aDateobjectfunction: If the given value is a function referenceobject: If the given value is an objectarray: If the given value is an arrayregexp: If the given value is a regular expressionelement: If the given value is a DOM Elementtextnode: If the given value is a DOM text node and contains something other than whitespacewhitespace: If the given value is a DOM text node and contains only whitespace
This method has been deprecated since 4.0.0
Use typeOf instead
Available since: 1.1.0
Parameters
- value : Object
Returns
Returns the type of the given variable in string format. List of possible values are:
undefined: If the given value isundefinednull: If the given value isnullstring: If the given value is a stringnumber: If the given value is a numberboolean: If the given value is a boolean valuedate: If the given value is aDateobjectfunction: If the given value is a function referenceobject: If the given value is an objectarray: If the given value is an arrayregexp: If the given value is a regular expressionelement: If the given value is a DOM Elementtextnode: If the given value is a DOM text node and contains something other than whitespacewhitespace: If the given value is a DOM text node and contains only whitespace
Available since: 4.0.0
Parameters
- value : Object
Returns
Old alias to Ext.Array.unique
Returns a new array with unique items
This method has been deprecated since 4.0.0
Use Ext.Array.unique instead
Available since: 3.4.0
Parameters
- array : Array
Returns
- Array
results
Alias for Ext.Object.fromQueryString.
Converts a query string back into an object.
Non-recursive:
Ext.Object.fromQueryString(foo=1&bar=2); // returns {foo: 1, bar: 2}
Ext.Object.fromQueryString(foo=&bar=2); // returns {foo: null, bar: 2}
Ext.Object.fromQueryString(some%20price=%24300); // returns {'some price': '0'}
Ext.Object.fromQueryString(colors=red&colors=green&colors=blue); // returns {colors: ['red', 'green', 'blue']}
Recursive:
Ext.Object.fromQueryString("username=Jacky&dateOfBirth[day]=1&dateOfBirth[month]=2&dateOfBirth[year]=1911&hobbies[0]=coding&hobbies[1]=eating&hobbies[2]=sleeping&hobbies[3][0]=nested&hobbies[3][1]=stuff", true);
// returns
{
username: 'Jacky',
dateOfBirth: {
day: '1',
month: '2',
year: '1911'
},
hobbies: ['coding', 'eating', 'sleeping', ['nested', 'stuff']]
}
This method has been deprecated since 4.0.0
Use Ext.Object.fromQueryString instead
Available since: 1.1.0
Parameters
- queryString : String
The query string to decode
- recursive : Boolean (optional)
Whether or not to recursively decode the string. This format is supported by PHP / Ruby on Rails servers and similar.
Defaults to:
false
Returns
Alias for Ext.Object.toQueryString.
Takes an object and converts it to an encoded query string.
Non-recursive:
Ext.Object.toQueryString({foo: 1, bar: 2}); // returns "foo=1&bar=2"
Ext.Object.toQueryString({foo: null, bar: 2}); // returns "foo=&bar=2"
Ext.Object.toQueryString({'some price': '0'}); // returns "some%20price=%24300"
Ext.Object.toQueryString({date: new Date(2011, 0, 1)}); // returns "date=%222011-01-01T00%3A00%3A00%22"
Ext.Object.toQueryString({colors: ['red', 'green', 'blue']}); // returns "colors=red&colors=green&colors=blue"
Recursive:
Ext.Object.toQueryString({
username: 'Jacky',
dateOfBirth: {
day: 1,
month: 2,
year: 1911
},
hobbies: ['coding', 'eating', 'sleeping', ['nested', 'stuff']]
}, true); // returns the following string (broken down and url-decoded for ease of reading purpose):
// username=Jacky
// &dateOfBirth[day]=1&dateOfBirth[month]=2&dateOfBirth[year]=1911
// &hobbies[0]=coding&hobbies[1]=eating&hobbies[2]=sleeping&hobbies[3][0]=nested&hobbies[3][1]=stuff
This method has been deprecated since 4.0.0
Use Ext.Object.toQueryString instead
Available since: 1.1.0
Parameters
- object : Object
The object to encode
- recursive : Boolean (optional)
Whether or not to interpret the object in recursive format. (PHP / Ruby on Rails servers and similar).
Defaults to:
false
Returns
- String
queryString
Utility method for returning a default value 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)
This method has been deprecated since 4.0.0
Use valueFrom instead
Available since: 2.3.0
Parameters
- value : Object
The value to test
- defaultValue : Object
The value to return if the original value is empty
- allowBlank : Boolean (optional)
true to allow zero length strings to qualify as non-empty (defaults to false)
Returns
- Object
value, if non-empty, else defaultValue
Returns the given value itself if it's not empty, as described in isEmpty; returns the default value (second argument) otherwise.
Available since: 4.0.0
Parameters
- value : Object
The value to test
- defaultValue : Object
The value to return if the original value is empty
- allowBlank : Boolean (optional)
true to allow zero length strings to qualify as non-empty (defaults to false)
Returns
- Object
value, if non-empty, else defaultValue
Convenient shorthand to create a widget by its xtype, also see Ext.ClassManager.instantiateByAlias
var button = Ext.widget('button'); // Equivalent to Ext.create('widget.button')
var panel = Ext.widget('panel'); // Equivalent to Ext.create('widget.panel')
Available since: 4.0.0
Parameters
Returns
- Object
widget instance
Zips N sets together.
// Example 1:
Ext.zip([1,2,3],[4,5,6]); // [[1,4],[2,5],[3,6]]
// Example 2:
Ext.zip(
[ "+", "-", "+"],
[ 12, 10, 22],
[ 43, 15, 96],
function(a, b, c){
return "$" + a + "" + b + "." + c
}
); // ["$+12.43", "$-10.15", "$+22.96"]
This method has been deprecated since 4.0.0
Will be removed in the next major version
Available since: 3.4.0
Parameters
- arr : Array/NodeList...
This argument may be repeated. Array(s) to contribute values.
- zipper : Function (optional)
The last item in the argument list. This will drive how the items are zipped together.
Returns
- Array
The zipped set.