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 set of useful static methods to deal with arrays; provide missing methods for older browsers.
This method returns the index that a given item would be inserted into the
given (sorted) array
. Note that the given item
may or may not be in the
array. This method will return the index of where the item should be.
For example:
var array = [ 'A', 'D', 'G', 'K', 'O', 'R', 'X' ];
var index = Ext.Array.binarySearch(array, 'E');
console.log('index: ' + index);
// logs "index: 2"
array.splice(index, 0, 'E');
console.log('array : ' + array.join(''));
// logs "array: ADEGKORX"
array : Object[]
The array to search.
item : Object
The item that you want to insert into the array
.
begin : Number (optional)
The first index in the array
to consider.
Defaults to: 0
end : Number (optional)
The index that marks the end of the range to consider. The item at this index is not considered.
Defaults to: array.length
compareFn : Function (optional)
The comparison function that matches the sort
order of the array
. The default compareFn
compares items using less-than
and greater-than operators.
The index for the given item in the given array based on the current sorters.
Filter through an array and remove empty item as defined in Ext.isEmpty.
See Ext.Array#filter
array : Array
results
Clone a flat array without referencing the previous one. Note that this is different
from Ext.clone
since it doesn't handle recursive cloning. It's simply a convenient, easy-to-remember method
for Array.prototype.slice.call(array)
.
array : Array
The array.
The clone array.
Checks whether or not the given array
contains the specified item
.
array : Array
The array to check.
item : Object
The item to find.
true
if the array contains the item, false
otherwise.
Perform a set difference A-B by subtracting all items in array B from array A.
arrayA : Array
arrayB : Array
difference
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
from the callback function.
Returning undefined
(i.e return;
) will only exit the callback function and
proceed with the next iteration of the loop.
Ext.Array.each(countries, function(name, index, countriesItSelf) {
if (name === 'Singapore') {
return false; // break here
}
});
Ext.each is alias for Ext.Array.each
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
. Returning undefined
(i.e
return;
) will only exit the callback function and proceed with the next iteration
in the loop.
scope : Object (optional)
The scope (this
reference) in which the specified function is executed.
reverse : Boolean (optional)
Reverse the iteration order (loop from the end to the beginning).
Defaults to: false
See description for the fn
parameter.
Shallow compares the contents of 2 arrays using strict equality.
array1 : Array
array2 : Array
true
if the arrays are equal.
Removes items from an array. This is functionally equivalent to the splice method of Array, but works around bugs in IE8's splice method and does not copy the removed elements in order to return them (because very often they are ignored).
array : Array
The Array on which to replace.
index : Number
The index in the array at which to operate.
removeCount : Number
The number of items to remove at index.
The array passed.
Executes the specified function for each array element until the function returns a falsy value.
If such an item is found, the function will return false
immediately.
Otherwise, it will return true
.
array : Array
fn : Function
Callback function for each item.
scope : Object
Callback function scope.
treu
if no false value is returned by the callback function.
Creates a new array with all of the elements of this array for which the provided filtering function returns a truthy value.
array : Array
fn : Function
Callback function for each item.
scope : Object
Callback function scope.
results
Returns the first item in the array which elicits a truthy return value from the passed selection function.
array : Array
The array to search
fn : Function
The selection function to execute for each item.
item : Mixed
The array item.
index : String
The index of the array item.
scope : Object (optional)
The scope (this
reference) in which the
function is executed. Defaults to the array
The first item in the array which returned true from the selection function, or null if none was found.
Recursively flattens into 1-d Array. Injects Arrays inline.
array : Array
The array to flatten
The 1-d array.
Iterates an array and invoke the given callback function for each item. Note that this will simply
delegate to the native Array.prototype.forEach
method if supported. It doesn't support stopping the
iteration by returning false
in the callback function like Ext.Array#each. However, performance
could be much better in modern browsers comparing with Ext.Array#each
array : Array
The array to iterate.
fn : Function
The callback function.
scope : Object
The execution scope (this
) in which the
specified function is executed.
Converts a value to an array if it's not already an array; returns:
undefined
or null
value : Object
The value to convert to an array if it's not already is an array.
newReference : Boolean (optional)
true
to clone the given array and return a new reference if necessary.
array
Push an item into the array only if the array doesn't contain it yet.
array : Array
The array.
item : Object
The item to include.
Get the index of the provided item
in the given array
, a supplement for the
missing arrayPrototype.indexOf in Internet Explorer.
array : Array
The array to check.
item : Object
The item to find.
from : Number
The index at which to begin the search.
The index of item in the array (or -1 if it is not found).
Inserts items in to an array.
array : Array
The Array in which to insert.
index : Number
The index in the array at which to operate.
items : Array
The array of items to insert at index.
The array passed.
Merge multiple arrays into one with unique items that exist in all of the arrays.
array1 : Array
array2 : Array
etc : Array
intersect
Creates a new array with the results of calling a provided function on every element in this array.
array : Array
fn : Function
Callback function for each item.
scope : Object (optional)
Callback function scope
results
Returns the maximum value in the Array.
array : Array/NodeList
The Array from which to select the maximum value.
comparisonFn : Function (optional)
a function to perform the comparison which determines maximization. If omitted the ">" operator will be used. Note: gt = 1; eq = 0; lt = -1
max : Mixed
Current maximum value.
item : Mixed
The value to compare with the current maximum.
maxValue The maximum value.
Calculates the mean of all items in the array.
array : Array
The Array to calculate the mean value of.
The mean.
Merge multiple arrays into one with unique items.
Ext.Array#union is alias for Ext.Array#merge
array1 : Array
array2 : Array
etc : Array
merged
Returns the minimum value in the Array.
array : Array/NodeList
The Array from which to select the minimum value.
comparisonFn : Function (optional)
a function to perform the comparison which determines minimization. If omitted the "<" operator will be used. Note: gt = 1; eq = 0; lt = -1
min : Mixed
Current minimum value.
item : Mixed
The value to compare with the current minimum.
minValue The minimum value.
A function used to sort an array by numeric value. By default, javascript array values are coerced to strings when sorting, which can be problematic when using numeric values. To ensure that the values are sorted numerically, this method can be passed to the sort method:
Ext.Array.sort(myArray, Ext.Array.numericSortFn);
a : Object
b : Object
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]
array : Array/NodeList
The Array of items to pluck the value from.
propertyName : String
The property name to pluck from each element.
The value from each item in the Array.
Pushes new items onto the end of an Array.
Passed parameters may be single items, or arrays of items. If an Array is found in the argument list, all its elements are pushed into the end of the target Array.
target : Array
The Array onto which to push new items
elements : Object...
The elements to add to the array. Each parameter may be an Array, in which case all the elements of that Array will be pushed into the end of the destination Array.
An array containing all the new items push onto the end.
This method applies the reduceFn
function against an accumulator and each
value of the array
(from left-to-right) to reduce it to a single value.
If no initialValue
is specified, the first element of the array is used as
the initial value. For example:
function reducer (previous, value, index) {
console.log('[' + index + ']: (' + previous + ',' + value + '}');
return previous * 10 + value;
}
v = Ext.Array.reduce([2, 3, 4], reducer);
console.log('v = ' + v);
> [1]: (2, 3)
> [2]: (23, 4)
> v = 234
v = Ext.Array.reduce([2, 3, 4], reducer, 1);
console.log('v = ' + v);
> [0]: (1, 2)
> [1]: (12, 3)
> [2]: (123, 4)
> v = 1234
Available since: 6.0.0
array : Array
The array to process.
reduceFn : Function
The reducing callback function.
initialValue : Mixed (optional)
The starting value.
The reduced value.
Removes the specified item from the array if it exists.
array : Array
The array.
item : Object
The item to remove.
The passed array.
Removes item/s at the specified index.
array : Array
The array.
index : Number
The index of the item to be removed.
count : Number (optional)
The number of items to be removed.
Defaults to: 1
The passed array.
Replaces items in an array. This is functionally equivalent to the splice method of Array, but works around bugs in IE8's splice method and is often more convenient to call because it accepts an array of items to insert rather than use a variadic argument list.
array : Array
The Array on which to replace.
index : Number
The index in the array at which to operate.
removeCount : Number
The number of items to remove at index (can be 0).
insert : Array (optional)
An array of items to insert at index.
The array passed.
Returns a shallow copy of a part of an array. This is equivalent to the native
call Array.prototype.slice.call(array, begin, end)
. This is often used when "array"
is "arguments" since the arguments object does not supply a slice method but can
be the context object to Array.prototype.slice
.
array : Array
The array (or arguments object).
begin : Number
The index at which to begin. Negative values are offsets from the end of the array.
end : Number
The index at which to end. The copied items do not include end. Negative values are offsets from the end of the array. If end is omitted, all items up to the end of the array are copied.
The copied piece of the array.
Executes the specified function for each array element until the function returns a truthy value.
If such an item is found, the function will return true
immediately. Otherwise, it will return false
.
array : Array
fn : Function
Callback function for each item.
scope : Object
Callback function scope.
true
if the callback function returns a truthy value.
Sorts the elements of an Array in a stable manner (equivalently keyed values do not move relative to each other). By default, this method sorts the elements alphabetically and ascending. Note: This method modifies the passed array, in the same manner as the native javascript Array.sort.
array : Array
The array to sort.
sortFn : Function (optional)
The comparison function.
a : Mixed
The first item to compare.
b : Mixed
The second item to compare.
return : Number
-1
if a < b, 1
if a > b, otherwise 0
.
The sorted array.
Replaces items in an array. This is equivalent to the splice method of Array, but works around bugs in IE8's splice method. The signature is exactly the same as the splice method except that the array is the first argument. All arguments following removeCount are inserted in the array at index.
array : Array
The Array on which to replace.
index : Number
The index in the array at which to operate.
removeCount : Number
The number of items to remove at index (can be 0).
elements : Object...
The elements to add to the array. If you don't specify any elements, splice simply removes elements from the array.
An array containing the removed items.
Calculates the sum of all items in the given array.
array : Array
The Array to calculate the sum value of.
The sum.
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']
Ext.toArray is alias for Ext.Array.toArray
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 1-based index that specifies the end of extraction.
Defaults to: -1
Creates a map (object) keyed by the elements of the given array. The values in the map are the index+1 of the array element. For example:
var map = Ext.Array.toMap(['a','b','c']);
// map = { a: 1, b: 2, c: 3 };
Or a key property can be specified:
var map = Ext.Array.toMap([
{ name: 'a' },
{ name: 'b' },
{ name: 'c' }
], 'name');
// map = { a: 1, b: 2, c: 3 };
Lastly, a key extractor can be provided:
var map = Ext.Array.toMap([
{ name: 'a' },
{ name: 'b' },
{ name: 'c' }
], function (obj) { return obj.name.toUpperCase(); });
// map = { A: 1, B: 2, C: 3 };
array : Array
The Array to create the map from.
getKey : String/Function (optional)
Name of the object property to use as a key or a function to extract the key.
scope : Object (optional)
Value of this
inside callback specified for getKey
.
The resulting map.
Creates a map (object) keyed by a property of elements of the given array. The values in the map are the array element. For example:
var map = Ext.Array.toValueMap(['a','b','c']);
// map = { a: 'a', b: 'b', c: 'c' };
Or a key property can be specified:
var map = Ext.Array.toValueMap([
{ name: 'a' },
{ name: 'b' },
{ name: 'c' }
], 'name');
// map = { a: {name: 'a'}, b: {name: 'b'}, c: {name: 'c'} };
Lastly, a key extractor can be provided:
var map = Ext.Array.toValueMap([
{ name: 'a' },
{ name: 'b' },
{ name: 'c' }
], function (obj) { return obj.name.toUpperCase(); });
// map = { A: {name: 'a'}, B: {name: 'b'}, C: {name: 'c'} };
array : Array
The Array to create the map from.
getKey : String/Function (optional)
Name of the object property to use as a key or a function to extract the key.
scope : Object (optional)
Value of this inside callback. This parameter is only
passed when getKey
is a function. If getKey
is not a function, the 3rd
argument is arrayify
.
arrayify : Number (optional)
Pass 1
to create arrays for all map entries
or 2
to create arrays for map entries that have 2 or more items with the
same key. This only applies when getKey
is specified. By default the map will
hold the last entry with a given key.
The resulting map.
Merge multiple arrays into one with unique items.
Ext.Array#union is alias for Ext.Array#merge
array1 : Array
array2 : Array
etc : Array
merged
Returns a new array with unique items.
array : Array
results