Docs Help

Terms, Icons, and Labels

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.

Access Levels

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.

Member Types

Member Syntax

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).

lookupComponent ( item ) : Ext.Component
protected

Called when a raw config object is added to this container either during initialization of the items config, or when new items are added), or {@link #insert inserted.

This method converts the passed object into an instanced child component.

This may be overridden in subclasses when special processing needs to be applied to child creation.

Parameters

item :  Object

The config object being added.

Returns
Ext.Component

The component to be added.

Let's look at each part of the member row:

Member Flags

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.

Class Icons

- 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

Member Icons

- 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

Class Member Quick-Nav Menu

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.

Getter and Setter Methods

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.

History Bar

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.

Search and Filters

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.

API Doc Class Metadata

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:

Expanding and Collapsing Examples and Class Members

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.

Desktop -vs- Mobile View

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:

Viewing the Class Source

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.

Ext JS 6.6.0 - Classic Toolkit


top

Ext.Object singleton

Hierarchy

Ext.Object

Summary

A collection of useful static methods to deal with objects.

No members found using the current filters

properties

methods

Instance Methods

chain ( object )

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.

Parameters

object :  Object

The prototype chain for the new object.

classify ( object )
private pri

Parameters

object :  Object

clear ( object ) : Object

This method removes all keys from the given object.

Parameters

object :  Object

The object from which to remove all keys.

Returns

:Object

The given object.

each ( object, fn, [scope] )

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
    }
});

Parameters

object :  Object

The object to iterate

fn :  Function

The callback function.

key :  String

value :  Object

object :  Object

The object itself

scope :  Object (optional)

The execution scope (this) of the callback function

eachValue ( object, fn, [scope] )

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.

Parameters

object :  Object

The object to iterate

fn :  Function

The callback function.

value :  Object

The value of

scope :  Object (optional)

The execution scope (this) of the callback function

equals ( object1, object2 ) : Boolean

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
});

Parameters

object1 :  Object

object2 :  Object

Returns

:Boolean

true if the objects are equal.

fork ( obj )
private pri

Parameters

obj :  Object

freeze ( obj, [deep] ) : Object

Freezes the given object making it immutable. This operation is by default shallow and does not effect objects referenced by the given object.

Parameters

obj :  Object

The object to freeze.

deep :  Boolean (optional)

Pass true to freeze sub-objects recursively.

Defaults to: false

Returns

:Object

The given object obj.

fromQueryString ( queryString, [recursive] ) : Object

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']]
}

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

:Object

getAllKeys ( object ) : String[]

Returns all keys of the given object as an array.

Parameters

object :  Object

Returns

:String[]

An array of keys from the object or any of its prototypes.

getKey ( object, value )

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'

Parameters

object :  Object

value :  Object

The value to find

getKeys ( object ) : String[]

Returns the hasOwnProperty keys of the given object as an array.

var values = Ext.Object.getKeys({
    name: 'Jacky',
    loves: 'food'
}); // ['name', 'loves']

Parameters

object :  Object

Returns

:String[]

An array of keys from the object

getSize ( object ) : Number

Gets the total number of this object's own properties

var size = Ext.Object.getSize({
    name: 'Jacky',
    loves: 'food'
}); // size equals 2

Parameters

object :  Object

Returns

:Number

size

getValues ( object ) : Array

Gets all values of the given object as an array.

var values = Ext.Object.getValues({
    name: 'Jacky',
    loves: 'food'
}); // ['Jacky', 'food']

Parameters

object :  Object

Returns

:Array

An array of values from the object

isEmpty ( object ) : Boolean

Checks if there are any properties on this object.

Parameters

object :  Object

Returns

:Boolean

true if there no properties on the object.

merge ( destination, object ) : 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
    }
}

Parameters

destination :  Object

The object into which all subsequent objects are merged.

object :  Object...

Any number of objects to merge into the destination.

Returns

:Object

merged The destination object with all passed objects merged in.

mergeIf ( destination )
private pri

Parameters

destination :  Object

toQueryObjects ( name, value, [recursive] ) : Object[]

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 },
];

Parameters

name :  String

value :  Object/Array

recursive :  Boolean (optional)

True to traverse object recursively

Defaults to: false

Returns

:Object[]

toQueryString ( object, [recursive] ) : String

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

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

Ext JS 6.6.0 - Classic Toolkit