The documentation for the ExtReact product diverges somewhat from the
documentation of other Sencha products. The sections below describe
documentation for all products except where indicated as unique to
ExtReact
.
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.
ExtReact component classes list the configurable name prominently at the top of the API class doc followed by the fully-qualified class name.
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.
ExtReact component classes display
configuration options as props
ExtReact component classes do not list
properties as a dedicated member type, but rather as
read only
props
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.
All ExtReact props are bindable
unless decorated as immutable
Immutable ExtReact props may not be use as a configurable prop when instantiating a component
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
Or in the case of an ExtReact component class this
indicates a member of type prop
- 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.
ExtReact component classes do not hoist the getter /
setter methods into the prop. All methods will be described in the
Methods
section
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.
Contains a collection of all stores that are created that have an identifier. An identifier can be assigned by setting the storeId property. When a store is in the StoreManager, it can be referred to via it's identifier:
new Ext.data.Store({
model: 'SomeModel',
storeId: 'myStore'
});
var store = Ext.data.StoreManager.lookup('myStore');
Also note that the lookup method is aliased to Ext#getStore for convenience.
If a store is registered with the StoreManager, you can also refer to the store by it's identifier when registering it with any Component that consumes data from a store:
new Ext.data.Store({
model: 'SomeModel',
storeId: 'myStore'
});
Ext.create('Ext.view.View', {
store: 'myStore',
// other configuration here
});
Configure as true
if the addAll function should add function references
to the collection.
The default sort direction to use if one is not specified.
Defaults to:
"ASC"
A config object containing one or more event handlers to be added to this object during initialization. This should be a valid listeners config object as specified in the addListener example for attaching multiple handlers at once.
DOM events from Ext JS Ext.Component
While some Ext JS Component classes export selected DOM events (e.g. "click",
"mouseover" etc), this is usually only done when extra value can be added. For example
the DataView's itemclick
event passing the node clicked on. To access DOM events directly from a child element
of a Component, we need to specify the element
option to identify the Component
property to add a DOM listener to:
new Ext.panel.Panel({
width: 400,
height: 200,
dockedItems: [{
xtype: 'toolbar'
}],
listeners: {
click: {
element: 'el', //bind to the underlying el property on the panel
fn: function(){ console.log('click el'); }
},
dblclick: {
element: 'body', //bind to the underlying body property on the panel
fn: function(){ console.log('dblclick body'); }
}
}
});
An alias for addListener. In versions prior to 5.1, listeners had a generated setter which could be called to add listeners. In 5.1 the listeners config is not processed using the config system and has no generated setter, so this method is provided for backward compatibility. The preferred way of adding listeners is to use the on method.
listeners : Object
The listeners
The maximum number of sorters which may be applied to this Sortable when using the "multi" insertion position when adding sorters.
New sorters added using the "multi" insertion position are inserted at the top of the sorters list becoming the new primary sort key.
If the sorters collection has grown to longer then multiSortLimit
, then it is trimmed.
Defaults to:
3
The initial set of Ext.util.Sorter.
sorters: [{
property: 'age',
direction: 'DESC'
}, {
property: 'firstName',
direction: 'ASC'
}]
Defaults to:
null
Matches options property names within a listeners specification object - property names which are never used as event names.
Defaults to:
{ scope: 1, delay: 1, buffer: 1, onFrame: 1, single: 1, args: 1, destroyable: 1, priority: 1, order: 1 }
We don't want the base destructor to clear the prototype because our destroyObservable handler must be called the very last. It will take care of the prototype after completing Observable destruction sequence.
Defaults to:
true
true
indicates an id
was auto-generated rather than provided by configuration.
Defaults to:
false
Available since: 6.7.0
Initial suspended call count. Incremented when suspendEvents is called, decremented when resumeEvents is called.
Defaults to:
0
This object holds a key for any event that has a listener. The listener may be set directly on the instance, or on its class or a super class (via observe) or on the MVC EventBus. The values of this object are truthy (a non-zero number) and falsy (0 or undefined). They do not represent an exact count of listeners. The value for an event is truthy if the event must be fired and is falsy if there is no need to fire the event.
The intended use of this property is to avoid the expense of fireEvent calls when there are no listeners. This can be particularly helpful when one would otherwise have to call fireEvent hundreds or thousands of times. It is used like this:
if (this.hasListeners.foo) {
this.fireEvent('foo', this, arg1);
}
Mutation counter for the index map which is synchronized with the collection's mutation counter when the index map is interrogated and found to be out of sync and needed a rebuild.
Defaults to:
0
true
in this class to identify an object as an instantiated MixedCollection,
or subclass thereof.
Defaults to:
true
true
in this class to identify an object as an instantiated Observable, or subclass
thereof.
Defaults to:
true
true
in this class to identify an object as an instantiated Sortable, or subclass thereof.
Defaults to:
true
Adds declarative listeners as nested arrays of listener objects.
listeners : Array
true
if any listeners were added
Performs the actual sorting based on a direction and a sorting function. Internally, this creates a temporary array of all items in the MixedCollection, sorts it and then writes the sorted array data back into this.items and this.keys
property : String
Property to sort by ('key', 'value', or 'index')
dir : String (optional)
Direction to sort 'ASC' or 'DESC'. Defaults to 'ASC'.
fn : Function (optional)
Comparison function that defines the sort order. Defaults to sorting by numeric value.
Adds an item to the collection. Fires the event-add event when complete.
Available since: 1.1.0
key : String/Object
The key to associate with the item, or the new item.
If a getKey implementation was specified for this MixedCollection,
or if the key of the stored items is in a property called id
,
the MixedCollection will be able to derive the key for the new item.
In this case just pass the new item in this parameter.
obj : Object (optional)
The item to add.
Note that when adding a value that is iterable, it must be wrapped in brackets, i.e.:
c.add([[1, 2]]);
This will be needed for any value that is iterable, i.e., an array, arguments object, HTML collections, etc.
The item added.
Adds all elements of an Array or an Object to the collection.
Available since: 1.1.0
objs : Object/Array
An Object containing properties which will be added
to the collection, or an Array of values, each of which are added to the collection.
Functions references will be added to the collection if allowFunctions
has been set to true
.
The on method is shorthand for addListener.
Appends an event handler to this object. For example:
myGridPanel.on("itemclick", this.onItemClick, this);
The method also allows for a single argument to be passed which is a config object containing properties which specify multiple events. For example:
myGridPanel.on({
cellclick: this.onCellClick,
select: this.onSelect,
viewready: this.onViewReady,
scope: this // Important. Ensure "this" is correct during handler execution
});
One can also specify options for each event handler separately:
myGridPanel.on({
cellclick: {fn: this.onCellClick, scope: this, single: true},
viewready: {fn: panel.onViewReady, scope: panel}
});
Names of methods in a specified scope may also be used:
myGridPanel.on({
cellclick: {fn: 'onCellClick', scope: this, single: true},
viewready: {fn: 'onViewReady', scope: panel}
});
eventName : String/Object
The name of the event to listen for. May also be an object who's property names are event names.
fn : Function/String (optional)
The method the event invokes or the name of
the method within the specified scope
. Will be called with arguments
given to Ext.util.Observable#fireEvent plus the options
parameter described
below.
scope : Object (optional)
The scope (this
reference) in which the handler function is
executed. If omitted, defaults to the object which fired the event.
options : Object (optional)
An object containing handler configuration.
Note: The options object will also be passed as the last argument to every event handler.
This object may contain any of the following properties:
scope : Object
The scope (this
reference) in which the handler function is executed. If omitted,
defaults to the object which fired the event.
delay : Number
The number of milliseconds to delay the invocation of the handler after the event fires.
single : Boolean
True to add a handler to handle just the next firing of the event, and then remove itself.
buffer : Number
Causes the handler to be scheduled to run in an Ext.util.DelayedTask delayed by the specified number of milliseconds. If the event fires again within that time, the original handler is not invoked, but the new handler is scheduled in its place.
onFrame : Number
Causes the handler to be scheduled to run at the next animation frame event. If the event fires again before that time, the handler is not rescheduled - the handler will only be called once when the next animation frame is fired, with the last set of arguments passed.
target : Ext.util.Observable
Only call the handler if the event was fired on the target Observable, not if the event was bubbled up from a child Observable.
element : String
This option is only valid for listeners bound to Ext.Component. The name of a Component property which references an Ext.dom.Element to add a listener to.
This option is useful during Component construction to add DOM event listeners to elements of Ext.Component which will exist only after the Component is rendered.
For example, to add a click listener to a Panel's body:
var panel = new Ext.panel.Panel({
title: 'The title',
listeners: {
click: this.handlePanelClick,
element: 'body'
}
});
In order to remove listeners attached using the element, you'll need to reference the element itself as seen below.
panel.body.un(...)
delegate : String (optional)
A simple selector to filter the event target or look for a descendant of the target.
The "delegate" option is only available on Ext.dom.Element instances (or when attaching a listener to a Ext.dom.Element via a Component using the element option).
See the delegate example below.
capture : Boolean (optional)
When set to true
, the listener is fired in the capture phase of the event propagation
sequence, instead of the default bubble phase.
The capture
option is only available on Ext.dom.Element instances (or
when attaching a listener to a Ext.dom.Element via a Component using the
element option).
stopPropagation : Boolean (optional)
This option is only valid for listeners bound to Ext.dom.Element.
true
to call stopPropagation on the event
object before firing the handler.
preventDefault : Boolean (optional)
This option is only valid for listeners bound to Ext.dom.Element.
true
to call preventDefault on the event
object before firing the handler.
stopEvent : Boolean (optional)
This option is only valid for listeners bound to Ext.dom.Element.
true
to call stopEvent on the event object
before firing the handler.
args : Array (optional)
Optional set of arguments to pass to the handler function before the actual
fired event arguments. For example, if args
is set to ['foo', 42]
,
the event handler function will be called with an arguments list like this:
handler('foo', 42, <actual event arguments>...);
destroyable : Boolean (optional)
When specified as true
, the function returns a destroyable
object. An object
which implements the destroy
method which removes all listeners added in this call.
This syntax can be a helpful shortcut to using un; particularly when
removing multiple listeners. NOTE - not compatible when using the element
option. See un for the proper syntax for removing listeners added using the
element config.
Defaults to:
false
priority : Number (optional)
An optional numeric priority that determines the order in which event handlers are run. Event handlers with no priority will be run as if they had a priority of 0. Handlers with a higher priority will be prioritized to run sooner than those with a lower priority. Negative numbers can be used to set a priority lower than the default. Internally, the framework uses a range of 1000 or greater, and -1000 or lesser for handlers that are intended to run before or after all others, so it is recommended to stay within the range of -999 to 999 when setting the priority of event handlers in application-level code. A priority must be an integer to be valid. Fractional values are reserved for internal framework use.
order : String (optional)
A legacy option that is provided for backward compatibility.
It is recommended to use the priority
option instead. Available options are:
'before'
: equal to a priority of 100
'current'
: equal to a priority of 0
or default priority'after'
: equal to a priority of -100
Defaults to:
'current'
order : String (optional)
A shortcut for the order
event option. Provided for backward compatibility.
Please use the priority
event option instead.
Defaults to: 'current'
Only when the destroyable
option is specified.
A Destroyable
object. An object which implements the destroy
method which removes
all listeners added in this call. For example:
this.btnListeners = = myButton.on({
destroyable: true
mouseover: function() { console.log('mouseover'); },
mouseout: function() { console.log('mouseout'); },
click: function() { console.log('click'); }
});
And when those listeners need to be removed:
Ext.destroy(this.btnListeners);
or
this.btnListeners.destroy();
The addManagedListener method is used when some object (call it "A") is listening to an event on another observable object ("B") and you want to remove that listener from "B" when "A" is destroyed. This is not an issue when "B" is destroyed because all of its listeners will be removed at that time.
Example:
Ext.define('Foo', {
extend: 'Ext.Component',
initComponent: function () {
this.addManagedListener(MyApp.SomeSharedMenu, 'show', this.doSomething);
this.callParent();
}
});
As you can see, when an instance of Foo is destroyed, it ensures that the 'show'
listener on the menu (MyApp.SomeGlobalSharedMenu
) is also removed.
As of version 5.1 it is no longer necessary to use this method in most cases because
listeners are automatically managed if the scope object provided to
addListener is an Observable instance.
However, if the observable instance and scope are not the same object you
still need to use mon
or addManagedListener
if you want the listener to be
managed.
item : Ext.util.Observable/Ext.dom.Element
The item to which to add a listener/listeners.
ename : Object/String
The event name, or an object containing event name properties.
fn : Function/String (optional)
If the ename
parameter was an event
name, this is the handler function or the name of a method on the specified
scope
.
scope : Object (optional)
If the ename
parameter was an event name, this is
the scope (this
reference) in which the handler function is executed.
options : Object (optional)
If the ename
parameter was an event name, this is
the addListener options.
Only when the destroyable
option is specified.
A Destroyable
object. An object which implements the destroy
method which removes
all listeners added in this call. For example:
this.btnListeners = myButton.mon({
destroyable: true
mouseover: function() { console.log('mouseover'); },
mouseout: function() { console.log('mouseout'); },
click: function() { console.log('click'); }
});
And when those listeners need to be removed:
Ext.destroy(this.btnListeners);
or
this.btnListeners.destroy();
Removes all items from the collection. Fires the event-clear event when complete.
Available since: 1.1.0
Creates a shallow copy of this collection
Available since: 1.1.0
Collects unique values of a particular property in this MixedCollection
property : String
The property to collect on
root : String (optional)
'root' property to extract the first argument from. This is used mainly when summing fields in records, where the fields are all stored inside the 'data' object
allowNull : Boolean (optional)
Pass true to allow null, undefined or empty string values
The unique values
Creates new MixedCollection.
config : Object
A configuration object.
allowFunctions : Boolean (optional)
Specify true
if the
addAll function should add function references to the collection.
Defaults to:
false
getKey : Function (optional)
A function that can accept an item of the type(s) stored in this MixedCollection and return the key value for that item. This is used when available to look up the key on items that were passed without an explicit key parameter to a MixedCollection method. Passing this parameter is equivalent to overriding the method-getKey method.
Returns true if the collection contains the passed Object as an item.
Available since: 1.1.0
o : Object
The Object to look for in the collection.
True if the collection contains the Object as an item.
Returns true if the collection contains the passed Object as a key.
Available since: 1.1.0
key : String
The key to look for in the collection.
True if the collection contains the Object as a key.
Creates an event handling function which re-fires the event from this object as the passed event name.
newName : String
The name under which to re-fire the passed parameters.
beginEnd : Array (optional)
The caller can specify on which indices to slice.
Returns a regular expression based on the given value and matching options. This is used internally for finding and filtering, and by Ext.data.Store#filter
Available since: 3.4.0
value : String
The value to create the regex for. This is escaped using Ext.escapeRe
anyMatch : Boolean
True to allow any match - no regex start/end line anchors will be added. Defaults to false
caseSensitive : Boolean
True to make the regex case sensitive (adds 'i' switch to regex). Defaults to false.
exactMatch : Boolean
True to force exact match (^ and $ characters added to the regex). Defaults to false. Ignored if anyMatch is true.
Normalizes an array of sorter objects, ensuring that they are all Ext.util.Sorter instances
sorters : Object[]
The sorters array
Array of Ext.util.Sorter objects
Continue to fire event.
eventName : String
args : Array
bubbles : Boolean
Executes the specified function once for every item in the collection. The function should return a boolean value. Returning false from the function will stop the iteration.
Available since: 1.1.0
fn : Function
The function to execute for each item.
scope : Object (optional)
The scope (this
reference)
in which the function is executed. Defaults to the current item in the iteration.
Executes the specified function once for every key in the collection, passing each key, and its associated item as the first two parameters.
Available since: 1.1.0
fn : Function
The function to execute for each item.
scope : Object (optional)
The scope (this
reference) in which the
function is executed. Defaults to the browser window.
Enables events fired by this Observable to bubble up an owner hierarchy by calling
this.getBubbleTarget()
if present. There is no implementation in the Observable
base class.
This is commonly used by Ext.Components to bubble events to owner Containers. See Ext.Component#getBubbleTarget. The default implementation in Ext.Component returns the Component's immediate owner. But if a known target is required, this can be overridden to access the required target more quickly.
Example:
Ext.define('Ext.overrides.form.field.Base', {
override: 'Ext.form.field.Base',
// Add functionality to Field's initComponent to enable
// the change event to bubble
initComponent: function () {
this.callParent();
this.enableBubble('change');
}
});
var myForm = Ext.create('Ext.form.Panel', {
title: 'User Details',
items: [{
...
}],
listeners: {
change: function() {
// Title goes red if form has been modified.
myForm.header.setStyle('color', 'red');
}
}
});
eventNames : String/String[]
The event name to bubble, or an Array of event names.
Extracts all of the given property values from the items in the MC. Mainly used as a supporting method for functions like sum and collect.
property : String
The property to extract
root : String (optional)
'root' property to extract the first argument from. This is used mainly when extracting field data from Model instances, where the fields are stored inside the 'data' object
The extracted values
Filters the objects in this collection by a set of Ext.util.Filters, or by a single property/value pair with optional parameters for substring matching and case sensitivity. See Ext.util.Filter for an example of using Filter objects (preferred). Alternatively, MixedCollection can be easily filtered by property like this:
// create a simple store with a few people defined
var people = new Ext.util.MixedCollection();
people.addAll([
{id: 1, age: 25, name: 'Ed'},
{id: 2, age: 24, name: 'Tommy'},
{id: 3, age: 24, name: 'Arne'},
{id: 4, age: 26, name: 'Aaron'}
]);
// a new MixedCollection containing only the items where age == 24
var middleAged = people.filter('age', 24);
Available since: 1.1.0
property : Ext.util.Filter[]/String
A property on your objects, or an array of Ext.util.Filter objects
value : String/RegExp
Either string that the property values should start with or a RegExp to test against the property
anyMatch : Boolean (optional)
True to match any part of the string, not just the beginning
Defaults to: false
caseSensitive : Boolean (optional)
True for case sensitive comparison.
Defaults to: false
The new filtered collection
Filter by a function. Returns a new collection that has been filtered. The passed function will be called with each object in the collection. If the function returns true, the value is included otherwise it is filtered.
Available since: 1.1.0
fn : Function
The function to be called.
item : Mixed
The collection item.
key : String
The key of collection item.
scope : Object (optional)
The scope (this
reference) in
which the function is executed. Defaults to this MixedCollection.
The new filtered collection
Returns the first item in the collection which elicits a true return value from the passed selection function.
Available since: 1.1.0
Deprecated since version 4.0
Use findBy instead.
Returns the first item in the collection which elicits a true return value from the passed selection function.
fn : Function
The selection function to execute for each item.
item : Mixed
The collection item.
key : String
The key of collection item.
scope : Object (optional)
The scope (this
reference) in which the
function is executed. Defaults to the browser window.
The first item in the collection which returned true from the selection function, or null if none was found.
Finds the index of the first matching object in this collection by a specific property/value.
Available since: 2.3.0
property : String
The name of a property on your objects.
value : String/RegExp
A string that the property values should start with or a RegExp to test against the property.
start : Number (optional)
The index to start searching at.
Defaults to: 0
anyMatch : Boolean (optional)
True to match any part of the string, not just the beginning.
Defaults to: false
caseSensitive : Boolean (optional)
True for case sensitive comparison.
Defaults to: false
The matched index or -1
Find the index of the first matching object in this collection by a function. If the function returns true it is considered a match.
Available since: 2.3.0
fn : Function
The function to be called.
item : Mixed
The collection item.
key : String
The key of collection item.
scope : Object (optional)
The scope (this
reference) in which the function
is executed. Defaults to this MixedCollection.
start : Number (optional)
The index to start searching at.
Defaults to: 0
The matched index or -1
Calculates the insertion index of the new item based upon the comparison function passed, or the current sort order.
newItem : Object
The new object to find the insertion position of.
sorterFn : Function (optional)
The function to sort by. This is the same as the sorting function passed to sortBy. It accepts 2 items from this MixedCollection, and returns -1 0, or 1 depending on the relative sort positions of the 2 compared items.
If omitted, a function generated from the currently defined set of cfg-sorters will be used.
The insertion point to add the new item into this MixedCollection at using insert
Fires the specified event with the passed parameters and executes a function (action).
By default, the action function will be executed after any "before" event handlers
(as specified using the order
option of
addListener
), but before any other
handlers are fired. This gives the "before" handlers an opportunity to
cancel the event by returning false
, and prevent the action function from
being called.
The action can also be configured to run after normal handlers, but before any "after"
handlers (as specified using the order
event option) by passing 'after'
as the order
parameter. This configuration gives any event handlers except
for "after" handlers the opportunity to cancel the event and prevent the action
function from being called.
eventName : String
The name of the event to fire.
args : Array
Arguments to pass to handlers and to the action function.
fn : Function
The action function.
scope : Object (optional)
The scope (this
reference) in which the handler function is
executed. If omitted, defaults to the object which fired the event.
options : Object (optional)
Event options for the action function. Accepts any
of the options of addListener
order : String (optional)
The order to call the action function relative
too the event handlers ('before'
or 'after'
). Note that this option is
simply used to sort the action function relative to the event handlers by "priority".
An order of 'before'
is equivalent to a priority of 99.5
, while an order of
'after'
is equivalent to a priority of -99.5
. See the priority
option
of addListener
for more details.
Defaults to: 'before'
Deprecated since version 5.5
Use fireEventedAction instead.
Fires the specified event with the passed parameters (minus the event name, plus
the options
object passed to addListener).
An event may be set to bubble up an Observable parent hierarchy (See Ext.Component#getBubbleTarget) by calling enableBubble.
eventName : String
The name of the event to fire.
args : Object...
Variable number of parameters are passed to handlers.
returns false if any of the handlers return false otherwise it returns true.
Fires the specified event with the passed parameter list.
An event may be set to bubble up an Observable parent hierarchy (See Ext.Component#getBubbleTarget) by calling enableBubble.
eventName : String
The name of the event to fire.
args : Object[]
An array of parameters which are passed to handlers.
returns false if any of the handlers return false otherwise it returns true.
Fires the specified event with the passed parameters and executes a function (action). Evented Actions will automatically dispatch a 'before' event passing. This event will be given a special controller that allows for pausing/resuming of the event flow.
By pausing the controller the updater and events will not run until resumed. Pausing, however, will not stop the processing of any other before events.
eventName : String
The name of the event to fire.
args : Array
Arguments to pass to handlers and to the action function.
fn : Function/String
The action function.
scope : Object (optional)
The scope (this
reference) in which the handler function is
executed. If omitted, defaults to the object which fired the event.
fnArgs : Array/Boolean (optional)
Optional arguments for the action fn
. If not
given, the normal args
will be used to call fn
. If false
is passed, the
args
are used but if the first argument is this instance it will be removed
from the args passed to the action function.
Returns the first item in the collection.
Available since: 1.1.0
the first item in the collection..
Returns a comparator function which compares two items and returns -1, 0, or 1 depending on the currently defined set of cfg-sorters.
If there are no cfg-sorters defined, it returns a function which returns 0
meaning
that no sorting will occur.
Returns the item associated with the passed key OR index. Key has priority over index. This is the equivalent of calling getByKey first, then if nothing matched calling getAt.
Available since: 1.1.0
key : String/Number
The key or index of the item.
If the item is found, returns the item. If the item was not found,
returns undefined
. If an item was found, but is a Class, returns null
.
Returns the item at the specified index.
index : Number
The index of the item.
The item at the specified index.
Gets the bubbling parent for an Observable
The bubble parent. null is returned if no bubble target exists
Returns the item associated with the passed key.
key : String/Number
The key of the item.
The item associated with the passed key.
Returns the number of items in the collection.
Available since: 1.1.0
the number of items in the collection.
Gets the first sorter from the sorters collection, excluding any groupers that may be in place
The sorter, null if none exist
Retrieves the id
. This method Will auto-generate an id if one has not already
been configured.
id
A function which will be called, passing a newly added object when the object is added without a separate id. The function should yield the key by which that object will be indexed.
If no key is yielded, then the object will be added, but it cannot be accessed or removed quickly. Finding it in this collection for interrogation or removal will require a linear scan of this collection's items.
The default implementation simply returns item.id
but you can
provide your own implementation to return a different value as
in the following examples:
// normal way
var mc = new Ext.util.MixedCollection();
mc.add(someEl.dom.id, someEl);
mc.add(otherEl.dom.id, otherEl);
//and so on
// using getKey
var mc = new Ext.util.MixedCollection({
getKey: function(el){
return el.dom.id;
}
});
mc.add(someEl);
mc.add(otherEl);
Available since: 1.1.0
item : Object
The item for which to find the key.
The key for the passed item.
This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.
Returns a range of items in this collection
Available since: 1.1.0
start : Number (optional)
The starting index. Defaults to 0.
end : Number (optional)
The ending index. Defaults to the last item.
An array of items
Returns the number of Sorters which apply to this Sortable.
May be overridden in subclasses. Ext.data.Store in particlar overrides this because its groupers must contribute to the sorter count so that the sort method above executes doSort.
Checks to see if this object has any listeners for a specified event, or whether the event bubbles. The answer indicates whether the event needs firing or not.
eventName : String
The name of the event to check for
true
if the event is being listened for or bubbles, else false
For API parity with Store's PageMap class. Buffered rendering checks if the Store has the range required to render. The Store delegates this question to its backing data object which may be an instance of its private PageMap class, or a MixedCollection.
start : Object
end : Object
Returns index within the collection of the passed Object.
Available since: 1.1.0
o : Object
The item to find the index of.
index of the item. Returns -1 if not found.
Returns index within the collection of the passed key.
Available since: 1.1.0
key : String
The key to find the index of.
index of the key.
Inserts an item at the specified index in the collection. Fires the event-add event when complete.
Available since: 1.1.0
index : Number
The index to insert the item at.
key : String/Object/String[]/Object[]
The key to associate with the new item, or the item itself. May also be an array of either to insert multiple items at once.
obj : Object/Object[] (optional)
If the second parameter was a key, the new item. May also be an array to insert multiple items at once.
The item inserted or an array of items inserted.
Checks if all events, or a specific event, is suspended.
event : String (optional)
The name of the specific event to check
true
if events are suspended
Returns the last item in the collection.
Available since: 1.1.0
the last item in the collection..
Gets a registered Store by id
store : String/Object
The id of the Store, or a Store instance, or a store configuration
defaultType : String (optional)
The store type to create when used with store configuration and there is no type specified on the config.
Shorthand for addManagedListener. The addManagedListener method is used when some object (call it "A") is listening to an event on another observable object ("B") and you want to remove that listener from "B" when "A" is destroyed. This is not an issue when "B" is destroyed because all of its listeners will be removed at that time.
Example:
Ext.define('Foo', {
extend: 'Ext.Component',
initComponent: function () {
this.addManagedListener(MyApp.SomeGlobalSharedMenu, 'show', this.doSomething);
this.callParent();
}
});
As you can see, when an instance of Foo is destroyed, it ensures that the 'show'
listener on the menu (MyApp.SomeGlobalSharedMenu
) is also removed.
As of version 5.1 it is no longer necessary to use this method in most cases because
listeners are automatically managed if the scope object provided to
addListener is an Observable instance.
However, if the observable instance and scope are not the same object you
still need to use mon
or addManagedListener
if you want the listener to be
managed.
item : Ext.util.Observable/Ext.dom.Element
The item to which to add a listener/listeners.
ename : Object/String
The event name, or an object containing event name properties.
fn : Function/String (optional)
If the ename
parameter was an event
name, this is the handler function or the name of a method on the specified
scope
.
scope : Object (optional)
If the ename
parameter was an event name, this is the scope (this
reference)
in which the handler function is executed.
options : Object (optional)
If the ename
parameter was an event name, this is the
addListener options.
Only when the destroyable
option is specified.
A Destroyable
object. An object which implements the destroy
method which removes all listeners added in this call. For example:
this.btnListeners = myButton.mon({
destroyable: true
mouseover: function() { console.log('mouseover'); },
mouseout: function() { console.log('mouseout'); },
click: function() { console.log('click'); }
});
And when those listeners need to be removed:
Ext.destroy(this.btnListeners);
or
this.btnListeners.destroy();
Shorthand for removeManagedListener. Removes listeners that were added by the mon method.
item : Ext.util.Observable/Ext.dom.Element
The item from which to remove a listener/listeners.
ename : Object/String
The event name, or an object containing event name properties.
fn : Function (optional)
If the ename
parameter was an event name, this is the handler function.
scope : Object (optional)
If the ename
parameter was an event name, this is the scope (this
reference)
in which the handler function is executed.
The on method is shorthand for addListener.
Appends an event handler to this object. For example:
myGridPanel.on("itemclick", this.onItemClick, this);
The method also allows for a single argument to be passed which is a config object containing properties which specify multiple events. For example:
myGridPanel.on({
cellclick: this.onCellClick,
select: this.onSelect,
viewready: this.onViewReady,
scope: this // Important. Ensure "this" is correct during handler execution
});
One can also specify options for each event handler separately:
myGridPanel.on({
cellclick: {fn: this.onCellClick, scope: this, single: true},
viewready: {fn: panel.onViewReady, scope: panel}
});
Names of methods in a specified scope may also be used:
myGridPanel.on({
cellclick: {fn: 'onCellClick', scope: this, single: true},
viewready: {fn: 'onViewReady', scope: panel}
});
eventName : String/Object
The name of the event to listen for. May also be an object who's property names are event names.
fn : Function/String (optional)
The method the event invokes or the name of
the method within the specified scope
. Will be called with arguments
given to Ext.util.Observable#fireEvent plus the options
parameter described
below.
scope : Object (optional)
The scope (this
reference) in which the handler function is
executed. If omitted, defaults to the object which fired the event.
options : Object (optional)
An object containing handler configuration.
Note: The options object will also be passed as the last argument to every event handler.
This object may contain any of the following properties:
scope : Object
The scope (this
reference) in which the handler function is executed. If omitted,
defaults to the object which fired the event.
delay : Number
The number of milliseconds to delay the invocation of the handler after the event fires.
single : Boolean
True to add a handler to handle just the next firing of the event, and then remove itself.
buffer : Number
Causes the handler to be scheduled to run in an Ext.util.DelayedTask delayed by the specified number of milliseconds. If the event fires again within that time, the original handler is not invoked, but the new handler is scheduled in its place.
onFrame : Number
Causes the handler to be scheduled to run at the next animation frame event. If the event fires again before that time, the handler is not rescheduled - the handler will only be called once when the next animation frame is fired, with the last set of arguments passed.
target : Ext.util.Observable
Only call the handler if the event was fired on the target Observable, not if the event was bubbled up from a child Observable.
element : String
This option is only valid for listeners bound to Ext.Component. The name of a Component property which references an Ext.dom.Element to add a listener to.
This option is useful during Component construction to add DOM event listeners to elements of Ext.Component which will exist only after the Component is rendered.
For example, to add a click listener to a Panel's body:
var panel = new Ext.panel.Panel({
title: 'The title',
listeners: {
click: this.handlePanelClick,
element: 'body'
}
});
In order to remove listeners attached using the element, you'll need to reference the element itself as seen below.
panel.body.un(...)
delegate : String (optional)
A simple selector to filter the event target or look for a descendant of the target.
The "delegate" option is only available on Ext.dom.Element instances (or when attaching a listener to a Ext.dom.Element via a Component using the element option).
See the delegate example below.
capture : Boolean (optional)
When set to true
, the listener is fired in the capture phase of the event propagation
sequence, instead of the default bubble phase.
The capture
option is only available on Ext.dom.Element instances (or
when attaching a listener to a Ext.dom.Element via a Component using the
element option).
stopPropagation : Boolean (optional)
This option is only valid for listeners bound to Ext.dom.Element.
true
to call stopPropagation on the event object
before firing the handler.
preventDefault : Boolean (optional)
This option is only valid for listeners bound to Ext.dom.Element.
true
to call preventDefault on the event object
before firing the handler.
stopEvent : Boolean (optional)
This option is only valid for listeners bound to Ext.dom.Element.
true
to call stopEvent on the event object
before firing the handler.
args : Array (optional)
Optional arguments to pass to the handler function. Any additional arguments passed to fireEvent will be appended to these arguments.
destroyable : Boolean (optional)
When specified as true
, the function returns a destroyable
object. An object
which implements the destroy
method which removes all listeners added in this call.
This syntax can be a helpful shortcut to using un; particularly when
removing multiple listeners. NOTE - not compatible when using the element
option. See un for the proper syntax for removing listeners added using the
element config.
Defaults to:
false
priority : Number (optional)
An optional numeric priority that determines the order in which event handlers are run. Event handlers with no priority will be run as if they had a priority of 0. Handlers with a higher priority will be prioritized to run sooner than those with a lower priority. Negative numbers can be used to set a priority lower than the default. Internally, the framework uses a range of 1000 or greater, and -1000 or lesser for handlers that are intended to run before or after all others, so it is recommended to stay within the range of -999 to 999 when setting the priority of event handlers in application-level code. A priority must be an integer to be valid. Fractional values are reserved for internal framework use.
order : String (optional)
A legacy option that is provided for backward compatibility.
It is recommended to use the priority
option instead. Available options are:
'before'
: equal to a priority of 100
'current'
: equal to a priority of 0
or default priority'after'
: equal to a priority of -100
Defaults to:
'current'
order : String (optional)
A shortcut for the order
event option. Provided for backward compatibility.
Please use the priority
event option instead.
Combining Options
Using the options argument, it is possible to combine different types of listeners:
A delayed, one-time listener.
myPanel.on('hide', this.handleClick, this, {
single: true,
delay: 100
});
Attaching multiple handlers in 1 call
The method also allows for a single argument to be passed which is a config object containing properties which specify multiple handlers and handler configs.
grid.on({
itemclick: 'onItemClick',
itemcontextmenu: grid.onItemContextmenu,
destroy: {
fn: function () {
// function called within the 'altCmp' scope instead of grid
},
scope: altCmp // unique scope for the destroy handler
},
scope: grid // default scope - provided for example clarity
});
Delegate
This is a configuration option that you can pass along when registering a handler for an event to assist with event delegation. By setting this configuration option to a simple selector, the target element will be filtered to look for a descendant of the target. For example:
var panel = Ext.create({
xtype: 'panel',
renderTo: document.body,
title: 'Delegate Handler Example',
frame: true,
height: 220,
width: 220,
html: '<h1 class="myTitle">BODY TITLE</h1>Body content'
});
// The click handler will only be called when the click occurs on the
// delegate: h1.myTitle ("h1" tag with class "myTitle")
panel.on({
click: function (e) {
console.log(e.getTarget().innerHTML);
},
element: 'body',
delegate: 'h1.myTitle'
});
Defaults to: 'current'
Only when the destroyable
option is specified.
A Destroyable
object. An object which implements the destroy
method which removes
all listeners added in this call. For example:
this.btnListeners = = myButton.on({
destroyable: true
mouseover: function() { console.log('mouseover'); },
mouseout: function() { console.log('mouseout'); },
click: function() { console.log('click'); }
});
And when those listeners need to be removed:
Ext.destroy(this.btnListeners);
or
this.btnListeners.destroy();
Appends an after-event handler.
Same as addListener with order
set
to 'after'
.
eventName : String/String[]/Object
The name of the event to listen for.
fn : Function/String
The method the event invokes.
scope : Object (optional)
The scope for fn
.
options : Object (optional)
An object containing handler configuration.
Appends a before-event handler. Returning false
from the handler will stop the event.
Same as addListener with order
set
to 'before'
.
eventName : String/String[]/Object
The name of the event to listen for.
fn : Function/String
The method the event invokes.
scope : Object (optional)
The scope for fn
.
options : Object (optional)
An object containing handler configuration.
Registers one or more Stores with the StoreManager. You do not normally need to register stores manually. Any store initialized with a Ext.data.Store#storeId will be auto-registered.
stores : Ext.data.Store...
Any number of Store instances
Relays selected events from the specified Observable as if the events were fired
by this
.
For example if you are extending Grid, you might decide to forward some events from store. So you can do this inside your initComponent:
this.relayEvents(this.getStore(), ['load']);
The grid instance will then have an observable 'load' event which will be passed the parameters of the store's load event and any function fired with the grid's load event would have access to the grid using the this keyword (unless the event is handled by a controller's control/listen event listener in which case 'this' will be the controller rather than the grid).
origin : Object
The Observable whose events this object is to relay.
events : String[]/Object
Array of event names to relay or an Object with key/value pairs translating to ActualEventName/NewEventName respectively. For example: this.relayEvents(this, {add:'push', remove:'pop'});
Would now redispatch the add event of this as a push event and the remove event as a pop event.
prefix : String (optional)
A common prefix to prepend to the event names. For example:
this.relayEvents(this.getStore(), ['load', 'clear'], 'store');
Now the grid will forward 'load' and 'clear' events of store as 'storeload' and 'storeclear'.
A Destroyable
object. An object which implements the destroy
method
which, when destroyed, removes all relayers. For example:
this.storeRelayers = this.relayEvents(this.getStore(), ['load', 'clear'], 'store');
Can be undone by calling
Ext.destroy(this.storeRelayers);
or this.store.relayers.destroy();
Remove an item from the collection.
Available since: 1.1.0
o : Object
The item to remove.
The item removed or false if no item was removed.
Remove all items in the collection. Can also be used to remove only the items in the passed array.
items : Array (optional)
An array of items to be removed.
this object
Remove an item from a specified index in the collection. Fires the event-remove event when complete.
Available since: 1.1.0
index : Number
The index within the collection of the item to remove.
The item removed or false if no item was removed.
Removes an item associated with the passed key fom the collection.
key : String
The key of the item to remove. If null
is passed,
all objects which yielded no key from the configured getKey function are removed.
Only returned if removing at a specified key. The item removed or false if no item was removed.
Removes an event handler.
eventName : String
The type of event the handler was associated with.
fn : Function
The handler to remove. This must be a reference to the function passed into the addListener call.
scope : Object (optional)
The scope originally specified for the handler. It must be the same as the scope argument specified in the original call to Ext.util.Observable#addListener or the listener will not be removed.
Removes listeners that were added by the mon method.
item : Ext.util.Observable/Ext.dom.Element
The item from which to remove a listener/listeners.
ename : Object/String
The event name, or an object containing event name properties.
fn : Function (optional)
If the ename
parameter was an event name, this is
the handler function.
scope : Object (optional)
If the ename
parameter was an event name, this is
the scope (this
reference) in which the handler function is executed.
Remove a single managed listener item
isClear : Boolean
True if this is being called during a clear
managedListener : Object
The managed listener item
item : Object
ename : String
fn : Function
scope : Object
See removeManagedListener for other args
Remove a range of items starting at a specified index in the collection. Does not fire the remove event.
index : Number
The index within the collection of the item to remove.
removeCount : Number (optional)
The nuber of items to remove beginning at the specified index.
Defaults to: 1
The last item removed or false if no item was removed.
Reorders each of the items based on a mapping from old index to new index. Internally this just translates into a sort. The 'sort' event is fired whenever reordering has occurred.
mapping : Object
Mapping from old item index to new item index
// example of moving the last of 4 items to the front of the collection
// and moving each one before it forward one
collection.reorder({
0: 1,
1: 2,
2: 3,
3: 0,
});
Replaces an item in the collection. Fires the event-replace event when complete.
Available since: 1.1.0
key : String
The key associated with the item to replace, or the replacement item.
If you supplied a getKey implementation for this MixedCollection, or if the key
of your stored items is in a property called id
, then the MixedCollection
will be able to derive the key of the replacement item. If you want to replace an item
with one having the same key value, then just pass the replacement item in this parameter.
o : Object
o (optional) If the first parameter passed was a key, the item to associate with that key.
The new item.
Gets the default scope for firing late bound events (string names with no scope attached) at runtime.
defaultScope : Object (optional)
The default scope to return if none is found.
Defaults to: this
The default event scope
Resumes firing of the named event(s).
After calling this method to resume events, the events will fire when requested to fire.
Note that if the suspendEvent method is called multiple times for a certain event, this converse method will have to be called the same number of times for it to resume firing.
eventName : String...
Multiple event names to resume.
Resumes firing events (see suspendEvents).
If events were suspended using the queueSuspended
parameter, then all events fired
during event suspension will be sent to any listeners now.
discardQueue : Boolean (optional)
true
to prevent any previously queued events from firing
while we were suspended. See suspendEvents.
Updates the sorters collection and triggers sorting of this Sortable. Example usage:
//sort by a single field
myStore.sort('myField', 'DESC');
//sorting by multiple fields
myStore.sort([{
property : 'age',
direction: 'ASC'
}, {
property : 'name',
direction: 'DESC'
}]);
Classes which use this mixin must implement a soSort
method which accepts a comparator
function computed from the full sorter set which performs the sort
in an implementation-specific way.
When passing a single string argument to sort, Store maintains a ASC/DESC toggler per field, so this code:
store.sort('myField');
store.sort('myField');
Is equivalent to this code, because Store handles the toggling automatically:
store.sort('myField', 'ASC');
store.sort('myField', 'DESC');
sorters : String/Ext.util.Sorter[] (optional)
Either a string name of one of the fields in this Store's configured Ext.data.Model, or an array of sorter configurations.
direction : String (optional)
The overall direction to sort the data by.
Defaults to: "ASC"
insertionPosition : String (optional)
Where to put the new sorter in the collection of sorters. This may take the following values:
replace
: This means that the new sorter(s) becomes the sole sorter set for this Sortable.
This is the most useful call mode to programatically sort by multiple fields.
prepend
: This means that the new sorters are inserted as the primary sorters, unchanged,
and the sorter list length must be controlled by the developer.
multi
: This is mainly useful for implementing intuitive "Sort by this" user interfaces
such as the GridPanel's column sorting UI. This mode is only
supported when passing a property name and a direction. This means that the new sorter
becomes the primary sorter. If the sorter was already the primary sorter, the direction
of sort is toggled if no direction parameter is specified. The number of sorters maintained
is limited by the multiSortLimit configuration.
append
: This means that the new sorter becomes the last sorter.
Defaults to: "replace"
doSort : Boolean
True to sort using a generated sorter function that combines all of the Sorters passed
The new sorters.
Sorts the collection by a single sorter function
sorterFn : Function
The function to sort by
Sorts this collection by keys.
dir : "ASC"/"DESC" (optional)
'ASC' or 'DESC'. Defaults to 'ASC'.
Defaults to: "ASC"
fn : Function (optional)
Comparison function that defines the sort order. Defaults to sorting by case insensitive string.
Collects all of the values of the given property and returns their sum
property : String
The property to sum by
root : String (optional)
'root' property to extract the first argument from. This is used mainly when summing fields in records, where the fields are all stored inside the 'data' object
start : Number (optional)
The record index to start at
Defaults to: 0
end : Number (optional)
The record index to end at
Defaults to: -1
The total
Suspends firing of the named event(s).
After calling this method to suspend events, the events will no longer fire when requested to fire.
Note that if this is called multiple times for a certain event, the converse method resumeEvent will have to be called the same number of times for it to resume firing.
eventName : String...
Multiple event names to suspend.
Suspends the firing of all events. (see resumeEvents)
queueSuspended : Boolean
true
to queue up suspended events to be fired
after the resumeEvents call instead of discarding all suspended events.
Shorthand for removeListener. Removes an event handler.
eventName : String
The type of event the handler was associated with.
fn : Function
The handler to remove. This must be a reference to the function passed into the addListener call.
scope : Object (optional)
The scope originally specified for the handler. It must be the same as the scope argument specified in the original call to Ext.util.Observable#addListener or the listener will not be removed.
Convenience Syntax
You can use the addListener
destroyable: true
config option in place of calling un(). For example:
var listeners = cmp.on({
scope: cmp,
afterrender: cmp.onAfterrender,
beforehide: cmp.onBeforeHide,
destroyable: true
});
// Remove listeners
listeners.destroy();
// or
cmp.un(
scope: cmp,
afterrender: cmp.onAfterrender,
beforehide: cmp.onBeforeHide
);
Exception - DOM event handlers using the element config option
You must go directly through the element to detach an event handler attached using the addListener element option.
panel.on({
element: 'body',
click: 'onBodyCLick'
});
panel.body.un({
click: 'onBodyCLick'
});
Removes a before-event handler.
Same as removeListener with order
set to 'after'
.
eventName : String/String[]/Object
The name of the event the handler was associated with.
fn : Function/String
The handler to remove.
scope : Object (optional)
The scope originally specified for fn
.
options : Object (optional)
Extra options object.
Removes a before-event handler.
Same as removeListener with order
set to 'before'
.
eventName : String/String[]/Object
The name of the event the handler was associated with.
fn : Function/String
The handler to remove.
scope : Object (optional)
The scope originally specified for fn
.
options : Object (optional)
Extra options object.
Unregisters one or more Stores with the StoreManager
stores : String/Object...
Any number of Store instances or ID-s
Change the key for an existing item in the collection. If the old key does not exist this is a no-op.
oldKey : Object
The old key
newKey : Object
The new key
Override members of this class. Overridden methods can be invoked via Ext.Base#callParent.
Ext.define('My.Cat', {
constructor: function() {
alert("I'm a cat!");
}
});
My.Cat.override({
constructor: function() {
alert("I'm going to be a cat!");
this.callParent(arguments);
alert("Meeeeoooowwww");
}
});
var kitty = new My.Cat(); // alerts "I'm going to be a cat!"
// alerts "I'm a cat!"
// alerts "Meeeeoooowwww"
Direct use of this method should be rare. Use Ext.define instead:
Ext.define('My.CatOverride', {
override: 'My.Cat',
constructor: function() {
alert("I'm going to be a cat!");
this.callParent(arguments);
alert("Meeeeoooowwww");
}
});
The above accomplishes the same result but can be managed by the Ext.Loader which can properly order the override and its target class and the build process can determine whether the override is needed based on the required state of the target class (My.Cat).
members : Object
The properties to add to this class. This should be specified as an object literal containing one or more properties.
this class
Fires when an item is added to the collection.
Available since: 1.1.0
index : Number
The index at which the item was added.
o : Object
The item added.
key : String
The key associated with the added item.
eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires before a sort occurs.
me : Ext.util.Sortable
This object.
sorters : Ext.util.Sorter[]
The collection of Sorters being used to generate the comparator function.
eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when an item is removed from the collection.
Available since: 1.1.0
o : Object
The item being removed.
key : String
The key associated with the removed item.
eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when an item is replaced in the collection.
Available since: 1.1.0
key : String
he key associated with the new added.
old : Object
The item being replaced.
new : Object
The new item.
eOpts : Object
The options object passed to Ext.util.Observable.addListener.