Many classes have shortcut names used when creating (instantiating) a class with a
configuration object. The shortcut name is referred to as an alias
(or xtype
if the
class extends Ext.Component). The alias/xtype is listed next to the class name of
applicable classes for quick reference.
Framework classes or their members may be specified as private
or protected
. Else,
the class / member is public
. Public
, protected
, and private
are access
descriptors used to convey how and when the class or class member should be used.
Public classes and class members are available for use by any other class or application code and may be relied upon as a stable and persistent within major product versions. Public classes and members may safely be extended via a subclass.
Protected class members are stable public
members intended to be used by the
owning class or its subclasses. Protected members may safely be extended via a subclass.
Private classes and class members are used internally by the framework and are not intended to be used by application developers. Private classes and members may change or be omitted from the framework at any time without notice and should not be relied upon in application logic.
static
label next to the
method name. *See Static below.Below is an example class member that we can disect to show the syntax of a class member (the lookupComponent method as viewed from the Ext.button.Button class in this case).
Let's look at each part of the member row:
lookupComponent
in this example)( item )
in this example)Ext.Component
in this case). This may be omitted for methods that do not
return anything other than undefined
or may display as multiple possible values
separated by a forward slash /
signifying that what is returned may depend on the
results of the method call (i.e. a method may return a Component if a get method calls is
successful or false
if unsuccessful which would be displayed as
Ext.Component/Boolean
).PROTECTED
in
this example - see the Flags section below)Ext.container.Container
in this example). The source
class will be displayed as a blue link if the member originates from the current class
and gray if it is inherited from an ancestor or mixed-in class.view source
in the example)item : Object
in the example).undefined
a "Returns" section
will note the type of class or object returned and a description (Ext.Component
in the
example)Available since 3.4.0
- not pictured in
the example) just after the member descriptionDefaults to: false
)The API documentation uses a number of flags to further commnicate the class member's function and intent. The label may be represented by a text label, an abbreviation, or an icon.
classInstance.method1().method2().etc();
false
is returned from
an event handler- Indicates a framework class
- A singleton framework class. *See the singleton flag for more information
- A component-type framework class (any class within the Ext JS framework that extends Ext.Component)
- Indicates that the class, member, or guide is new in the currently viewed version
- Indicates a class member of type config
- Indicates a class member of type property
- Indicates a class member of type
method
- Indicates a class member of type event
- Indicates a class member of type
theme variable
- Indicates a class member of type
theme mixin
- Indicates that the class, member, or guide is new in the currently viewed version
Just below the class name on an API doc page is a row of buttons corresponding to the types of members owned by the current class. Each button shows a count of members by type (this count is updated as filters are applied). Clicking the button will navigate you to that member section. Hovering over the member-type button will reveal a popup menu of all members of that type for quick navigation.
Getting and setter methods that correlate to a class config option will show up in the methods section as well as in the configs section of both the API doc and the member-type menus just beneath the config they work with. The getter and setter method documentation will be found in the config row for easy reference.
Your page history is kept in localstorage and displayed (using the available real estate) just below the top title bar. By default, the only search results shown are the pages matching the product / version you're currently viewing. You can expand what is displayed by clicking on the button on the right-hand side of the history bar and choosing the "All" radio option. This will show all recent pages in the history bar for all products / versions.
Within the history config menu you will also see a listing of your recent page visits. The results are filtered by the "Current Product / Version" and "All" radio options. Clicking on the button will clear the history bar as well as the history kept in local storage.
If "All" is selected in the history config menu the checkbox option for "Show product details in the history bar" will be enabled. When checked, the product/version for each historic page will show alongside the page name in the history bar. Hovering the cursor over the page names in the history bar will also show the product/version as a tooltip.
Both API docs and guides can be searched for using the search field at the top of the page.
On API doc pages there is also a filter input field that filters the member rows using the filter string. In addition to filtering by string you can filter the class members by access level, inheritance, and read only. This is done using the checkboxes at the top of the page.
The checkbox at the bottom of the API class navigation tree filters the class list to include or exclude private classes.
Clicking on an empty search field will show your last 10 searches for quick navigation.
Each API doc page (with the exception of Javascript primitives pages) has a menu view of metadata relating to that class. This metadata view will have one or more of the following:
Ext.button.Button
class has an alternate class name of Ext.Button
). Alternate class
names are commonly maintained for backward compatibility.Runnable examples (Fiddles) are expanded on a page by default. You can collapse and expand example code blocks individually using the arrow on the top-left of the code block. You can also toggle the collapse state of all examples using the toggle button on the top-right of the page. The toggle-all state will be remembered between page loads.
Class members are collapsed on a page by default. You can expand and collapse members using the arrow icon on the left of the member row or globally using the expand / collapse all toggle button top-right.
Viewing the docs on narrower screens or browsers will result in a view optimized for a smaller form factor. The primary differences between the desktop and "mobile" view are:
The class source can be viewed by clicking on the class name at the top of an API doc page. The source for class members can be viewed by clicking on the "view source" link on the right-hand side of the member row.
A collection of useful static methods to deal with objects.
Returns a new object with the given object as the prototype chain. This method is
designed to mimic the ECMA standard Object.create
method and is assigned to that
function when it is available.
NOTE This method does not support the property definitions capability of the
Object.create
method. Only the first argument is supported.
object : Object
The prototype chain for the new object.
This method removes all keys from the given object.
object : Object
The object from which to remove all keys.
The given object.
Iterates through an object and invokes the given callback function for each iteration.
The iteration can be stopped by returning false
in the callback function. For example:
var person = {
name: 'Jacky'
hairColor: 'black'
loves: ['food', 'sleeping', 'wife']
};
Ext.Object.each(person, function(key, value, myself) {
console.log(key + ":" + value);
if (key === 'hairColor') {
return false; // stop the iteration
}
});
object : Object
The object to iterate
scope : Object (optional)
The execution scope (this
) of the callback function
Iterates through an object and invokes the given callback function for each iteration.
The iteration can be stopped by returning false
in the callback function. For example:
var items = {
1: 'Hello',
2: 'World'
};
Ext.Object.eachValue(items, function(value) {
console.log("Value: " + value);
});
This will log 'Hello' and 'World' in no particular order. This method is useful in cases where the keys are not important to the processing, just the values.
object : Object
The object to iterate
scope : Object (optional)
The execution scope (this
) of the callback function
Shallow compares the contents of 2 objects using strict equality. Objects are considered equal if they both have the same set of properties and the value for those properties equals the other in the corresponding object.
// Returns true
Ext.Object.equals({
foo: 1,
bar: 2
}, {
foo: 1,
bar: 2
});
object1 : Object
object2 : Object
true
if the objects are equal.
Freezes the given object making it immutable. This operation is by default shallow and does not effect objects referenced by the given object.
obj : Object
The object to freeze.
deep : Boolean (optional)
Pass true
to freeze sub-objects recursively.
Defaults to: false
The given object obj
.
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: '', bar: '2'}
Ext.Object.fromQueryString("some%20price=%24300"); // returns {'some price': '$300'}
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']]
}
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 all keys of the given object as an array.
object : Object
An array of keys from the object or any of its prototypes.
Returns the first matching key corresponding to the given value. If no matching value is found, null is returned.
var person = {
name: 'Jacky',
loves: 'food'
};
alert(Ext.Object.getKey(person, 'food')); // alerts 'loves'
object : Object
value : Object
The value to find
Returns the hasOwnProperty
keys of the given object as an array.
var values = Ext.Object.getKeys({
name: 'Jacky',
loves: 'food'
}); // ['name', 'loves']
object : Object
An array of keys from the object
Gets the total number of this object's own properties
var size = Ext.Object.getSize({
name: 'Jacky',
loves: 'food'
}); // size equals 2
object : Object
size
Gets all values of the given object as an array.
var values = Ext.Object.getValues({
name: 'Jacky',
loves: 'food'
}); // ['Jacky', 'food']
object : Object
An array of values from the object
Checks if there are any properties on this object.
object : Object
true
if there no properties on the object.
Merges any number of objects recursively without referencing them or their children. Note: It will reference arrays if they are only present in one of the objects being merged.
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: 40000,
location: 'Redwood City',
isFun: true
}
}
destination : Object
The object into which all subsequent objects are merged.
object : Object...
Any number of objects to merge into the destination.
merged The destination object with all passed objects merged in.
Converts a name
- value
pair to an array of objects with support for nested structures.
Useful to construct query strings. For example:
var objects = Ext.Object.toQueryObjects('hobbies', ['reading', 'cooking', 'swimming']);
// objects then equals:
[
{ name: 'hobbies', value: 'reading' },
{ name: 'hobbies', value: 'cooking' },
{ name: 'hobbies', value: 'swimming' },
];
var objects = Ext.Object.toQueryObjects('dateOfBirth', {
day: 3,
month: 8,
year: 1987,
extra: {
hour: 4
minute: 30
}
}, true); // Recursive
// objects then equals:
[
{ name: 'dateOfBirth[day]', value: 3 },
{ name: 'dateOfBirth[month]', value: 8 },
{ name: 'dateOfBirth[year]', value: 1987 },
{ name: 'dateOfBirth[extra][hour]', value: 4 },
{ name: 'dateOfBirth[extra][minute]', value: 30 },
];
name : String
value : Object/Array
recursive : Boolean (optional)
True to traverse object recursively
Defaults to: false
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': '$300'}); // 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
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
queryString