Ext.data.JsonP.Ext_util_AbstractMixedCollection({"alternateClassNames":[],"aliases":{},"enum":null,"parentMixins":[],"tagname":"class","subclasses":["Ext.util.MixedCollection"],"extends":"Ext.Base","uses":[],"html":"
Hierarchy
Ext.BaseExt.util.AbstractMixedCollectionMixins
Requires
Subclasses
Files
NOTE This is a private utility class for internal use by the framework. Don't rely on its existence.
\nSpecify true
if the addAll\nfunction should add function references to the collection. Defaults to\nfalse
.
Defaults to: false
Available since: 3.4.0
\nA config object containing one or more event handlers to be added to this object during initialization. This\nshould be a valid listeners config object as specified in the addListener example for attaching multiple\nhandlers at once.
\n\nDOM events from Ext JS Components
\n\nWhile some Ext JS Component classes export selected DOM events (e.g. \"click\", \"mouseover\" etc), this is usually\nonly 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\nchild element of a Component, we need to specify the element
option to identify the Component property to add a\nDOM listener to:
new Ext.panel.Panel({\n width: 400,\n height: 200,\n dockedItems: [{\n xtype: 'toolbar'\n }],\n listeners: {\n click: {\n element: 'el', //bind to the underlying el property on the panel\n fn: function(){ console.log('click el'); }\n },\n dblclick: {\n element: 'body', //bind to the underlying body property on the panel\n fn: function(){ console.log('dblclick body'); }\n }\n }\n});\n
\nInitial suspended call count. Incremented when suspendEvents is called, decremented when resumeEvents is called.
\nDefaults to: 0
Mutation counter which is incremented upon add and remove.
\nDefaults to: 0
This object holds a key for any event that has a listener. The listener may be set\ndirectly on the instance, or on its class or a super class (via observe) or\non the MVC EventBus. The values of this object are truthy\n(a non-zero number) and falsy (0 or undefined). They do not represent an exact count\nof listeners. The value for an event is truthy if the event must be fired and is\nfalsy if there is no need to fire the event.
\n\nThe intended use of this property is to avoid the expense of fireEvent calls when\nthere are no listeners. This can be particularly helpful when one would otherwise\nhave to call fireEvent hundreds or thousands of times. It is used like this:
\n\n if (this.hasListeners.foo) {\n this.fireEvent('foo', this, arg1);\n }\n
\nMutation counter for the index map which is synchronized with the collection's mutation counter\nwhen the index map is interrogated and found to be out of sync and needed a rebuild.
\nDefaults 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
Get the reference to the current class from which this object was instantiated. Unlike statics,\nthis.self
is scope-dependent and it's meant to be used for dynamic inheritance. See statics\nfor a detailed comparison
Ext.define('My.Cat', {\n statics: {\n speciesName: 'Cat' // My.Cat.speciesName = 'Cat'\n },\n\n constructor: function() {\n alert(this.self.speciesName); // dependent on 'this'\n },\n\n clone: function() {\n return new this.self();\n }\n});\n\n\nExt.define('My.SnowLeopard', {\n extend: 'My.Cat',\n statics: {\n speciesName: 'Snow Leopard' // My.SnowLeopard.speciesName = 'Snow Leopard'\n }\n});\n\nvar cat = new My.Cat(); // alerts 'Cat'\nvar snowLeopard = new My.SnowLeopard(); // alerts 'Snow Leopard'\n\nvar clone = snowLeopard.clone();\nalert(Ext.getClassName(clone)); // alerts 'My.SnowLeopard'\n
\nAdds an item to the collection. Fires the add event when complete.
\nAvailable since: 1.1.0
\nThe key to associate with the item, or the new item.
\n\nIf a getKey implementation was specified for this MixedCollection,\nor if the key of the stored items is in a property called id
,\nthe MixedCollection will be able to derive the key for the new item.\nIn this case just pass the new item in this parameter.
The item to add.
\nThe item added.
\nAdds all elements of an Array or an Object to the collection.
\nAvailable since: 1.1.0
\nAn Object containing properties which will be added\nto the collection, or an Array of values, each of which are added to the collection.\nFunctions references will be added to the collection if allowFunctions
\nhas been set to true
.
Adds the specified events to the list of events which this Observable may fire.
\nEither an object with event names as properties with\na value of true
. For example:
this.addEvents({\n storeloaded: true,\n storecleared: true\n});\n
\n\nOr any number of event names as separate parameters. For example:
\n\nthis.addEvents('storeloaded', 'storecleared');\n
\nAppends an event handler to this object. For example:
\n\nmyGridPanel.on(\"mouseover\", this.onMouseOver, this);\n
\n\nThe method also allows for a single argument to be passed which is a config object\ncontaining properties which specify multiple events. For example:
\n\nmyGridPanel.on({\n cellClick: this.onCellClick,\n mouseover: this.onMouseOver,\n mouseout: this.onMouseOut,\n scope: this // Important. Ensure \"this\" is correct during handler execution\n});\n
\n\nOne can also specify options for each event handler separately:
\n\nmyGridPanel.on({\n cellClick: {fn: this.onCellClick, scope: this, single: true},\n mouseover: {fn: panel.onMouseOver, scope: panel}\n});\n
\n\nNames of methods in a specified scope may also be used. Note that\nscope
MUST be specified to use this option:
myGridPanel.on({\n cellClick: {fn: 'onCellClick', scope: this, single: true},\n mouseover: {fn: 'onMouseOver', scope: panel}\n});\n
\nThe name of the event to listen for.\nMay also be an object who's property names are event names.
\n\nThe method the event invokes, or if scope
is specified, the name* of the method within\nthe specified scope
. Will be called with arguments\ngiven to fireEvent plus the options
parameter described below.
The scope (this
reference) in which the handler function is\nexecuted. If omitted, defaults to the object which fired the event.
An object containing handler configuration.
\n\n\n\n\nNote: Unlike in ExtJS 3.x, the options object will also be passed as the last\nargument to every event handler.
\n\n\n\n\nThis object may contain any of the following properties:
\n\nThe scope (this
reference) in which the handler function is executed. If omitted,\n defaults to the object which fired the event.
The number of milliseconds to delay the invocation of the handler after the event fires.
\n\nTrue to add a handler to handle just the next firing of the event, and then remove itself.
\n\nCauses the handler to be scheduled to run in an Ext.util.DelayedTask delayed\n by the specified number of milliseconds. If the event fires again within that time,\n the original handler is not invoked, but the new handler is scheduled in its place.
\n\nOnly call the handler if the event was fired on the target Observable, not if the event\n was bubbled up from a child Observable.
\n\nThis option is only valid for listeners bound to Components.\n The name of a Component property which references an element to add a listener to.
\n\n\n\n\nThis option is useful during Component construction to add DOM event listeners to elements of\n Components which will exist only after the Component is rendered.\n For example, to add a click listener to a Panel's body:
\n\n\n\n\n new Ext.panel.Panel({\n title: 'The title',\n listeners: {\n click: this.handlePanelClick,\n element: 'body'\n }\n });\n
\n\nWhen specified as true
, the function returns A Destroyable
object. An object which implements the destroy
method which removes all listeners added in this call.
Defaults to: false
An optional numeric priority that determines the order in which event handlers\n are run. Event handlers with no priority will be run as if they had a priority\n of 0. Handlers with a higher priority will be prioritized to run sooner than\n those with a lower priority. Negative numbers can be used to set a priority\n lower than the default. Internally, the framework uses a range of 1000 or\n greater, and -1000 or lesser for handers that are intended to run before or\n after all others, so it is recommended to stay within the range of -999 to 999\n when setting the priority of event handlers in application-level code.
\n\n\n\n\nCombining Options
\n\n\n\n\nUsing the options argument, it is possible to combine different types of listeners:
\n\n\n\n\nA delayed, one-time listener.
\n\n\n\n\nmyPanel.on('hide', this.handleClick, this, {\n single: true,\n delay: 100\n});\n
\n\nOnly 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({\n destroyable: true\n mouseover: function() { console.log('mouseover'); },\n mouseout: function() { console.log('mouseout'); },\n click: function() { console.log('click'); }\n});\n
\n\n\n\n\nAnd when those listeners need to be removed:
\n\n\n\n\nExt.destroy(this.btnListeners);\n
\n\n\n\n\nor
\n\n\n\n\nthis.btnListeners.destroy();\n
\n\nAdds listeners to any Observable object (or Ext.Element) which are automatically removed when this Component is\ndestroyed.
\nThe item to which to add a listener/listeners.
\n\nThe event name, or an object containing event name properties.
\n\nIf the ename
parameter was an event name, this is the handler function.
If the ename
parameter was an event name, this is the scope (this
reference)\nin which the handler function is executed.
If the ename
parameter was an event name, this is the\naddListener 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({\n destroyable: true\n mouseover: function() { console.log('mouseover'); },\n mouseout: function() { console.log('mouseout'); },\n click: function() { console.log('click'); }\n});\n
\n\n\n\n\nAnd when those listeners need to be removed:
\n\n\n\n\nExt.destroy(this.btnListeners);\n
\n\n\n\n\nor
\n\n\n\n\nthis.btnListeners.destroy();\n
\n\nCall the original method that was previously overridden with override
\n\nExt.define('My.Cat', {\n constructor: function() {\n alert(\"I'm a cat!\");\n }\n});\n\nMy.Cat.override({\n constructor: function() {\n alert(\"I'm going to be a cat!\");\n\n this.callOverridden();\n\n alert(\"Meeeeoooowwww\");\n }\n});\n\nvar kitty = new My.Cat(); // alerts \"I'm going to be a cat!\"\n // alerts \"I'm a cat!\"\n // alerts \"Meeeeoooowwww\"\n
\n This method has been deprecated
\nas of 4.1. Use callParent instead.
\n\nThe arguments, either an array or the arguments
object\nfrom the current method, for example: this.callOverridden(arguments)
Returns the result of calling the overridden method
\nCall the \"parent\" method of the current method. That is the method previously\noverridden by derivation or by an override (see Ext.define).
\n\n Ext.define('My.Base', {\n constructor: function (x) {\n this.x = x;\n },\n\n statics: {\n method: function (x) {\n return x;\n }\n }\n });\n\n Ext.define('My.Derived', {\n extend: 'My.Base',\n\n constructor: function () {\n this.callParent([21]);\n }\n });\n\n var obj = new My.Derived();\n\n alert(obj.x); // alerts 21\n
\n\nThis can be used with an override as follows:
\n\n Ext.define('My.DerivedOverride', {\n override: 'My.Derived',\n\n constructor: function (x) {\n this.callParent([x*2]); // calls original My.Derived constructor\n }\n });\n\n var obj = new My.Derived();\n\n alert(obj.x); // now alerts 42\n
\n\nThis also works with static methods.
\n\n Ext.define('My.Derived2', {\n extend: 'My.Base',\n\n statics: {\n method: function (x) {\n return this.callParent([x*2]); // calls My.Base.method\n }\n }\n });\n\n alert(My.Base.method(10); // alerts 10\n alert(My.Derived2.method(10); // alerts 20\n
\n\nLastly, it also works with overridden static methods.
\n\n Ext.define('My.Derived2Override', {\n override: 'My.Derived2',\n\n statics: {\n method: function (x) {\n return this.callParent([x*2]); // calls My.Derived2.method\n }\n }\n });\n\n alert(My.Derived2.method(10); // now alerts 40\n
\n\nTo override a method and replace it and also call the superclass method, use\ncallSuper. This is often done to patch a method to fix a bug.
\nThe arguments, either an array or the arguments
object\nfrom the current method, for example: this.callParent(arguments)
Returns the result of calling the parent method
\nThis method is used by an override to call the superclass method but bypass any\noverridden method. This is often done to \"patch\" a method that contains a bug\nbut for whatever reason cannot be fixed directly.
\n\nConsider:
\n\n Ext.define('Ext.some.Class', {\n method: function () {\n console.log('Good');\n }\n });\n\n Ext.define('Ext.some.DerivedClass', {\n method: function () {\n console.log('Bad');\n\n // ... logic but with a bug ...\n\n this.callParent();\n }\n });\n
\n\nTo patch the bug in DerivedClass.method
, the typical solution is to create an\noverride:
Ext.define('App.paches.DerivedClass', {\n override: 'Ext.some.DerivedClass',\n\n method: function () {\n console.log('Fixed');\n\n // ... logic but with bug fixed ...\n\n this.callSuper();\n }\n });\n
\n\nThe patch method cannot use callParent
to call the superclass method
since\nthat would call the overridden method containing the bug. In other words, the\nabove patch would only produce \"Fixed\" then \"Good\" in the console log, whereas,\nusing callParent
would produce \"Fixed\" then \"Bad\" then \"Good\".
The arguments, either an array or the arguments
object\nfrom the current method, for example: this.callSuper(arguments)
Returns the result of calling the superclass method
\nRemoves all items from the collection. Fires the clear event when complete.
\nAvailable since: 1.1.0
\nRemoves all listeners for this object including the managed listeners
\nCreates a shallow copy of this collection
\nAvailable since: 1.1.0
\nCollects unique values of a particular property in this MixedCollection
\nThe property to collect on
\n'root' property to extract the first argument from. This is used mainly when\nsumming fields in records, where the fields are all stored inside the 'data' object
\nPass true to allow null, undefined or empty string values
\nThe unique values
\nReturns a regular expression based on the given value and matching options. This is used internally for finding and filtering,\nand by Ext.data.Store.filter
\nAvailable since: 3.4.0
\nThe value to create the regex for. This is escaped using Ext.escapeRe
\nTrue to allow any match - no regex start/end line anchors will be added. Defaults to false
\nTrue to make the regex case sensitive (adds 'i' switch to regex). Defaults to false.
\nTrue to force exact match (^ and $ characters added to the regex). Defaults to false. Ignored if anyMatch is true.
\nExecutes the specified function once for every item in the collection.\nThe function should return a boolean value.\nReturning false from the function will stop the iteration.
\nAvailable since: 1.1.0
\nExecutes the specified function once for every key in the collection, passing each\nkey, and its associated item as the first two parameters.
\nAvailable since: 1.1.0
\nEnables events fired by this Observable to bubble up an owner hierarchy by calling this.getBubbleTarget()
if\npresent. There is no implementation in the Observable base class.
This is commonly used by Ext.Components to bubble events to owner Containers.\nSee Ext.Component.getBubbleTarget. The default implementation in Ext.Component returns the\nComponent's immediate owner. But if a known target is required, this can be overridden to access the\nrequired target more quickly.
\n\nExample:
\n\nExt.define('Ext.overrides.form.field.Base', {\n override: 'Ext.form.field.Base',\n\n // Add functionality to Field's initComponent to enable the change event to bubble\n initComponent: function () {\n this.callParent();\n this.enableBubble('change');\n }\n});\n\nvar myForm = Ext.create('Ext.form.Panel', {\n title: 'User Details',\n items: [{\n ...\n }],\n listeners: {\n change: function() {\n // Title goes red if form has been modified.\n myForm.header.setStyle('color', 'red');\n }\n }\n});\n
\nExtracts all of the given property values from the items in the MC. Mainly used as a supporting method for\nfunctions like sum and collect.
\nThe property to extract
\n'root' property to extract the first argument from. This is used mainly when\nextracting field data from Model instances, where the fields are stored inside the 'data' object
\nThe extracted values
\nFilters the objects in this collection by a set of Filters, or by a single\nproperty/value pair with optional parameters for substring matching and case sensitivity. See\nFilter for an example of using Filter objects (preferred). Alternatively,\nMixedCollection can be easily filtered by property like this:
\n\n\n//create a simple store with a few people defined\n var people = new Ext.util.MixedCollection();\n people.addAll([
\n\n {id: 1, age: 25, name: 'Ed'},\n {id: 2, age: 24, name: 'Tommy'},\n {id: 3, age: 24, name: 'Arne'},\n {id: 4, age: 26, name: 'Aaron'}\n
\n\n]);
\n\n//a new MixedCollection containing only the items where age == 24\n var middleAged = people.filter('age', 24);
\nAvailable since: 1.1.0
\nA property on your objects, or an array of Filter objects
\nEither string that the property values\nshould start with or a RegExp to test against the property
\nTrue to match any part of the string, not just the beginning
\nDefaults to: false
True for case sensitive comparison.
\nDefaults to: false
The new filtered collection
\nFilter by a function. Returns a new collection that has been filtered.\nThe passed function will be called with each object in the collection.\nIf the function returns true, the value is included otherwise it is filtered.
\nAvailable since: 1.1.0
\nThe function to be called.
\nThe collection item.
\nThe key of collection item.
\nThe scope (this
reference) in\nwhich the function is executed. Defaults to this MixedCollection.
The new filtered collection
\nReturns the first item in the collection which elicits a true return value from the passed selection function.
\nThis method has been deprecated since 4.0
\nUse findBy instead.
\n\nAvailable since: 1.1.0
\nReturns the first item in the collection which elicits a true return value from the\npassed selection function.
\nThe selection function to execute for each item.
\nThe collection item.
\nThe key of collection item.
\nThe scope (this
reference) in which the\nfunction is executed. Defaults to the browser window.
The first item in the collection which returned true from the selection\nfunction, or null if none was found.
\nFinds the index of the first matching object in this collection by a specific property/value.
\nAvailable since: 2.3.0
\nThe name of a property on your objects.
\nA string that the property values\nshould start with or a RegExp to test against the property.
\nThe index to start searching at.
\nDefaults to: 0
True to match any part of the string, not just the beginning.
\nDefaults to: false
True for case sensitive comparison.
\nDefaults to: false
The matched index or -1
\nFind the index of the first matching object in this collection by a function.\nIf the function returns true it is considered a match.
\nAvailable since: 2.3.0
\nThe function to be called.
\nThe collection item.
\nThe key of collection item.
\nThe scope (this
reference) in which the function is executed. Defaults to this MixedCollection.
The index to start searching at.
\nDefaults to: 0
The matched index or -1
\nFires the specified event with the passed parameters (minus the event name, plus the options
object passed\nto addListener).
An event may be set to bubble up an Observable parent hierarchy (See Ext.Component.getBubbleTarget) by\ncalling enableBubble.
\nThe name of the event to fire.
\nVariable number of parameters are passed to handlers.
\nreturns false if any of the handlers return false otherwise it returns true.
\nFires the specified event with the passed parameter list.
\n\nAn event may be set to bubble up an Observable parent hierarchy (See Ext.Component.getBubbleTarget) by\ncalling enableBubble.
\nThe name of the event to fire.
\nAn array of parameters which are passed to handlers.
\nreturns false if any of the handlers return false otherwise it returns true.
\nReturns the first item in the collection.
\nAvailable since: 1.1.0
\nthe first item in the collection..
\nReturns the item associated with the passed key OR index.\nKey has priority over index. This is the equivalent\nof calling getByKey first, then if nothing matched calling getAt.
\nAvailable since: 1.1.0
\nIf the item is found, returns the item. If the item was not found, returns undefined
.\nIf an item was found, but is a Class, returns null
.
Gets the bubbling parent for an Observable
\nThe bubble parent. null is returned if no bubble target exists
\nReturns the number of items in the collection.
\nAvailable since: 1.1.0
\nthe number of items in the collection.
\nA function which will be called, passing a newly added object\nwhen the object is added without a separate id. The function\nshould yield the key by which that object will be indexed.
\n\nIf no key is yielded, then the object will be added, but it\ncannot be accessed or removed quickly. Finding it in this\ncollection for interrogation or removal will require a linear\nscan of this collection's items.
\n\nThe default implementation simply returns item.id
but you can\nprovide your own implementation to return a different value as\nin the following examples:
// normal way\nvar mc = new Ext.util.MixedCollection();\nmc.add(someEl.dom.id, someEl);\nmc.add(otherEl.dom.id, otherEl);\n//and so on\n\n// using getKey\nvar mc = new Ext.util.MixedCollection({\n getKey: function(el){\n return el.dom.id;\n }\n});\nmc.add(someEl);\nmc.add(otherEl);\n
\n Available since: 1.1.0
\nThis is a template method.\n a hook into the functionality of this class.\n Feel free to override it in child classes.
\nThe item for which to find the key.
\nThe key for the passed item.
\nChecks to see if this object has any listeners for a specified event, or whether the event bubbles. The answer\nindicates whether the event needs firing or not.
\nThe name of the event to check for
\ntrue
if the event is being listened for or bubbles, else false
Initialize configuration for this class. a typical example:
\n\nExt.define('My.awesome.Class', {\n // The default config\n config: {\n name: 'Awesome',\n isAwesome: true\n },\n\n constructor: function(config) {\n this.initConfig(config);\n }\n});\n\nvar awesome = new My.awesome.Class({\n name: 'Super Awesome'\n});\n\nalert(awesome.getName()); // 'Super Awesome'\n
\nthis
\nInserts an item at the specified index in the collection. Fires the add event when complete.
\nAvailable since: 1.1.0
\nThe index to insert the item at.
\nThe key to associate with the new item, or the item itself.\nMay also be an array of either to insert multiple items at once.
\nIf the second parameter was a key, the new item.\nMay also be an array to insert multiple items at once.
\nThe item inserted or an array of items inserted.
\nReturns the last item in the collection.
\nAvailable since: 1.1.0
\nthe last item in the collection..
\nShorthand for addManagedListener.
\n\nAdds listeners to any Observable object (or Ext.Element) which are automatically removed when this Component is\ndestroyed.
\nThe item to which to add a listener/listeners.
\n\nThe event name, or an object containing event name properties.
\n\nIf the ename
parameter was an event name, this is the handler function.
If the ename
parameter was an event name, this is the scope (this
reference)\nin which the handler function is executed.
If the ename
parameter was an event name, this is the\naddListener 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({\n destroyable: true\n mouseover: function() { console.log('mouseover'); },\n mouseout: function() { console.log('mouseout'); },\n click: function() { console.log('click'); }\n});\n
\n\n\n\n\nAnd when those listeners need to be removed:
\n\n\n\n\nExt.destroy(this.btnListeners);\n
\n\n\n\n\nor
\n\n\n\n\nthis.btnListeners.destroy();\n
\n\nShorthand for removeManagedListener.
\n\nRemoves listeners that were added by the mon method.
\nThe item from which to remove a listener/listeners.
\n\nThe event name, or an object containing event name properties.
\n\nIf the ename
parameter was an event name, this is the handler function.
If the ename
parameter was an event name, this is the scope (this
reference)\nin which the handler function is executed.
Shorthand for addListener.
\n\nAppends an event handler to this object. For example:
\n\nmyGridPanel.on(\"mouseover\", this.onMouseOver, this);\n
\n\nThe method also allows for a single argument to be passed which is a config object\ncontaining properties which specify multiple events. For example:
\n\nmyGridPanel.on({\n cellClick: this.onCellClick,\n mouseover: this.onMouseOver,\n mouseout: this.onMouseOut,\n scope: this // Important. Ensure \"this\" is correct during handler execution\n});\n
\n\nOne can also specify options for each event handler separately:
\n\nmyGridPanel.on({\n cellClick: {fn: this.onCellClick, scope: this, single: true},\n mouseover: {fn: panel.onMouseOver, scope: panel}\n});\n
\n\nNames of methods in a specified scope may also be used. Note that\nscope
MUST be specified to use this option:
myGridPanel.on({\n cellClick: {fn: 'onCellClick', scope: this, single: true},\n mouseover: {fn: 'onMouseOver', scope: panel}\n});\n
\nThe name of the event to listen for.\nMay also be an object who's property names are event names.
\n\nThe method the event invokes, or if scope
is specified, the name* of the method within\nthe specified scope
. Will be called with arguments\ngiven to fireEvent plus the options
parameter described below.
The scope (this
reference) in which the handler function is\nexecuted. If omitted, defaults to the object which fired the event.
An object containing handler configuration.
\n\n\n\n\nNote: Unlike in ExtJS 3.x, the options object will also be passed as the last\nargument to every event handler.
\n\n\n\n\nThis object may contain any of the following properties:
\n\nThe scope (this
reference) in which the handler function is executed. If omitted,\n defaults to the object which fired the event.
The number of milliseconds to delay the invocation of the handler after the event fires.
\n\nTrue to add a handler to handle just the next firing of the event, and then remove itself.
\n\nCauses the handler to be scheduled to run in an Ext.util.DelayedTask delayed\n by the specified number of milliseconds. If the event fires again within that time,\n the original handler is not invoked, but the new handler is scheduled in its place.
\n\nOnly call the handler if the event was fired on the target Observable, not if the event\n was bubbled up from a child Observable.
\n\nThis option is only valid for listeners bound to Components.\n The name of a Component property which references an element to add a listener to.
\n\n\n\n\nThis option is useful during Component construction to add DOM event listeners to elements of\n Components which will exist only after the Component is rendered.\n For example, to add a click listener to a Panel's body:
\n\n\n\n\n new Ext.panel.Panel({\n title: 'The title',\n listeners: {\n click: this.handlePanelClick,\n element: 'body'\n }\n });\n
\n\nWhen specified as true
, the function returns A Destroyable
object. An object which implements the destroy
method which removes all listeners added in this call.
Defaults to: false
An optional numeric priority that determines the order in which event handlers\n are run. Event handlers with no priority will be run as if they had a priority\n of 0. Handlers with a higher priority will be prioritized to run sooner than\n those with a lower priority. Negative numbers can be used to set a priority\n lower than the default. Internally, the framework uses a range of 1000 or\n greater, and -1000 or lesser for handers that are intended to run before or\n after all others, so it is recommended to stay within the range of -999 to 999\n when setting the priority of event handlers in application-level code.
\n\n\n\n\nCombining Options
\n\n\n\n\nUsing the options argument, it is possible to combine different types of listeners:
\n\n\n\n\nA delayed, one-time listener.
\n\n\n\n\nmyPanel.on('hide', this.handleClick, this, {\n single: true,\n delay: 100\n});\n
\n\nOnly 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({\n destroyable: true\n mouseover: function() { console.log('mouseover'); },\n mouseout: function() { console.log('mouseout'); },\n click: function() { console.log('click'); }\n});\n
\n\n\n\n\nAnd when those listeners need to be removed:
\n\n\n\n\nExt.destroy(this.btnListeners);\n
\n\n\n\n\nor
\n\n\n\n\nthis.btnListeners.destroy();\n
\n\nPrepares a given class for observable instances. This method is called when a\nclass derives from this class or uses this class as a mixin.
\nThe class constructor to prepare.
\nRelays 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.\nSo you can do this inside your initComponent:
\n\nthis.relayEvents(this.getStore(), ['load']);\n
\n\nThe grid instance will then have an observable 'load' event which will be passed the\nparameters of the store's load event and any function fired with the grid's load event\nwould have access to the grid using the this
keyword.
The Observable whose events this object is to relay.
\nArray of event names to relay.
\nA common prefix to prepend to the event names. For example:
\n\nthis.relayEvents(this.getStore(), ['load', 'clear'], 'store');\n
\n\nNow the grid will forward 'load' and 'clear' events of store as 'storeload' and 'storeclear'.
\nA 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');\n
\n\nCan be undone by calling
\n\nExt.destroy(this.storeRelayers);\n
\n\nor
\n\nthis.store.relayers.destroy();\n
\nRemove all items in the collection. Can also be used\nto remove only the items in the passed array.
\nAn array of items to be removed.
\nthis object
\nRemoves an item associated with the passed key fom the collection.
\nThe key of the item to remove. If null
is passed,\nall 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.
\nRemoves an event handler.
\nThe type of event the handler was associated with.
\n\nThe handler to remove. This must be a reference to the function passed into the\naddListener call.
\n\nThe scope originally specified for the handler. It must be the same as the\nscope argument specified in the original call to addListener or the listener will not be removed.
\n\nRemoves listeners that were added by the mon method.
\nThe item from which to remove a listener/listeners.
\n\nThe event name, or an object containing event name properties.
\n\nIf the ename
parameter was an event name, this is the handler function.
If the ename
parameter was an event name, this is the scope (this
reference)\nin which the handler function is executed.
Remove a range of items starting at a specified index in the collection.\nDoes not fire the remove event.
\nThe index within the collection of the item to remove.
\nThe nuber of items to remove beginning at the specified index.
\nDefaults to: 1
The last item removed or false if no item was removed.
\nReplaces an item in the collection. Fires the replace event when complete.
\nAvailable since: 1.1.0
\nThe key associated with the item to replace, or the replacement item.
\n\nIf you supplied a getKey implementation for this MixedCollection, or if the key\nof your stored items is in a property called id
, then the MixedCollection\nwill be able to derive the key of the replacement item. If you want to replace an item\nwith one having the same key value, then just pass the replacement item in this parameter.
{Object} o (optional) If the first parameter passed was a key, the item to associate\nwith that key.
\nThe new item.
\nResumes firing of the named event(s).
\n\nAfter calling this method to resume events, the events will fire when requested to fire.
\n\nNote that if the suspendEvent method is called multiple times for a certain event,\nthis converse method will have to be called the same number of times for it to resume firing.
\nMultiple event names to resume.
\nResumes firing events (see suspendEvents).
\n\nIf events were suspended using the queueSuspended
parameter, then all events fired\nduring event suspension will be sent to any listeners now.
Get the reference to the class from which this object was instantiated. Note that unlike self,\nthis.statics()
is scope-independent and it always returns the class from which it was called, regardless of what\nthis
points to during run-time
Ext.define('My.Cat', {\n statics: {\n totalCreated: 0,\n speciesName: 'Cat' // My.Cat.speciesName = 'Cat'\n },\n\n constructor: function() {\n var statics = this.statics();\n\n alert(statics.speciesName); // always equals to 'Cat' no matter what 'this' refers to\n // equivalent to: My.Cat.speciesName\n\n alert(this.self.speciesName); // dependent on 'this'\n\n statics.totalCreated++;\n },\n\n clone: function() {\n var cloned = new this.self; // dependent on 'this'\n\n cloned.groupName = this.statics().speciesName; // equivalent to: My.Cat.speciesName\n\n return cloned;\n }\n});\n\n\nExt.define('My.SnowLeopard', {\n extend: 'My.Cat',\n\n statics: {\n speciesName: 'Snow Leopard' // My.SnowLeopard.speciesName = 'Snow Leopard'\n },\n\n constructor: function() {\n this.callParent();\n }\n});\n\nvar cat = new My.Cat(); // alerts 'Cat', then alerts 'Cat'\n\nvar snowLeopard = new My.SnowLeopard(); // alerts 'Cat', then alerts 'Snow Leopard'\n\nvar clone = snowLeopard.clone();\nalert(Ext.getClassName(clone)); // alerts 'My.SnowLeopard'\nalert(clone.groupName); // alerts 'Cat'\n\nalert(My.Cat.totalCreated); // alerts 3\n
\nCollects all of the values of the given property and returns their sum
\nThe property to sum by
\n'root' property to extract the first argument from. This is used mainly when\nsumming fields in records, where the fields are all stored inside the 'data' object
\nThe record index to start at
\nDefaults to: 0
The record index to end at
\nDefaults to: -1
The total
\nSuspends firing of the named event(s).
\n\nAfter calling this method to suspend events, the events will no longer fire when requested to fire.
\n\nNote that if this is called multiple times for a certain event, the converse method\nresumeEvent will have to be called the same number of times for it to resume firing.
\nMultiple event names to suspend.
\nSuspends the firing of all events. (see resumeEvents)
\nPass as true to queue up suspended events to be fired\nafter the resumeEvents call instead of discarding all suspended events.
\nShorthand for removeListener.
\n\nRemoves an event handler.
\nThe type of event the handler was associated with.
\n\nThe handler to remove. This must be a reference to the function passed into the\naddListener call.
\n\nThe scope originally specified for the handler. It must be the same as the\nscope argument specified in the original call to addListener or the listener will not be removed.
\n\nAdd methods / properties to the prototype of this class.
\n\nExt.define('My.awesome.Cat', {\n constructor: function() {\n ...\n }\n});\n\n My.awesome.Cat.addMembers({\n meow: function() {\n alert('Meowww...');\n }\n });\n\n var kitty = new My.awesome.Cat;\n kitty.meow();\n
\nAdd / override static properties of this class.
\n\nExt.define('My.cool.Class', {\n ...\n});\n\nMy.cool.Class.addStatics({\n someProperty: 'someValue', // My.cool.Class.someProperty = 'someValue'\n method1: function() { ... }, // My.cool.Class.method1 = function() { ... };\n method2: function() { ... } // My.cool.Class.method2 = function() { ... };\n});\n
\nthis
\nBorrow another class' members to the prototype of this class.
\n\nExt.define('Bank', {\n money: '$$$',\n printMoney: function() {\n alert('$$$$$$$');\n }\n});\n\nExt.define('Thief', {\n ...\n});\n\nThief.borrow(Bank, ['money', 'printMoney']);\n\nvar steve = new Thief();\n\nalert(steve.money); // alerts '$$$'\nsteve.printMoney(); // alerts '$$$$$$$'\n
\nThe class to borrow members from
\nThe names of the members to borrow
\nthis
\nCreate a new instance of this Class.
\n\nExt.define('My.cool.Class', {\n ...\n});\n\nMy.cool.Class.create({\n someConfig: true\n});\n
\n\nAll parameters are passed to the constructor of the class.
\nthe created instance.
\nCreate aliases for existing prototype methods. Example:
\n\nExt.define('My.cool.Class', {\n method1: function() { ... },\n method2: function() { ... }\n});\n\nvar test = new My.cool.Class();\n\nMy.cool.Class.createAlias({\n method3: 'method1',\n method4: 'method2'\n});\n\ntest.method3(); // test.method1()\n\nMy.cool.Class.createAlias('method5', 'method3');\n\ntest.method5(); // test.method3() -> test.method1()\n
\nThe new method name, or an object to set multiple aliases. See\nflexSetter
\nThe original method name
\nGet the current class' name in string format.
\n\nExt.define('My.cool.Class', {\n constructor: function() {\n alert(this.self.getName()); // alerts 'My.cool.Class'\n }\n});\n\nMy.cool.Class.getName(); // 'My.cool.Class'\n
\nclassName
\nAdds members to class.
\nThis method has been deprecated since 4.1
\nUse addMembers instead.
\n\nOverride members of this class. Overridden methods can be invoked via\ncallParent.
\n\nExt.define('My.Cat', {\n constructor: function() {\n alert(\"I'm a cat!\");\n }\n});\n\nMy.Cat.override({\n constructor: function() {\n alert(\"I'm going to be a cat!\");\n\n this.callParent(arguments);\n\n alert(\"Meeeeoooowwww\");\n }\n});\n\nvar kitty = new My.Cat(); // alerts \"I'm going to be a cat!\"\n // alerts \"I'm a cat!\"\n // alerts \"Meeeeoooowwww\"\n
\n\nAs of 4.1, direct use of this method is deprecated. Use Ext.define\ninstead:
\n\nExt.define('My.CatOverride', {\n override: 'My.Cat',\n constructor: function() {\n alert(\"I'm going to be a cat!\");\n\n this.callParent(arguments);\n\n alert(\"Meeeeoooowwww\");\n }\n});\n
\n\nThe above accomplishes the same result but can be managed by the Ext.Loader\nwhich can properly order the override and its target class and the build process\ncan determine whether the override is needed based on the required state of the\ntarget class (My.Cat).
\nThis method has been deprecated since 4.1.0
\nUse Ext.define instead
\n\nThe properties to add to this class. This should be\nspecified as an object literal containing one or more properties.
\nthis class
\nFires when an item is added to the collection.
\nAvailable since: 1.1.0
\nThe index at which the item was added.
\nThe item added.
\nThe key associated with the added item.
\nThe options object passed to Ext.util.Observable.addListener.
\n\n\n\nFires when the collection is cleared.
\nAvailable since: 1.1.0
\nThe options object passed to Ext.util.Observable.addListener.
\n\n\n\nFires when an item is removed from the collection.
\nAvailable since: 1.1.0
\nThe item being removed.
\nThe key associated with the removed item.
\nThe options object passed to Ext.util.Observable.addListener.
\n\n\n\nFires when an item is replaced in the collection.
\nAvailable since: 1.1.0
\nhe key associated with the new added.
\nThe item being replaced.
\nThe new item.
\nThe options object passed to Ext.util.Observable.addListener.
\n\n\n\n