|
| MixedCollection( Boolean allowFunctions , Function keyFn )
+ Parameters:allowFunctions : BooleanSpecify true if the addAll
+function should add function references to the collection. Defaults to
+ false. keyFn : FunctionA 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 providing an implementation for the getKey method. Returns: | MixedCollection |
| add( String key , Object o )
- :
+equivalent to providing an implementation for the getKey method.Returns: | MixedCollection |
| add( String key , Object o )
+ :
ObjectAdds an item to the collection. Fires the add event when complete. Adds an item to the collection. Fires the add event when complete. Parameters:key : StringThe key to associate with the item, or the new 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 for the new item. In this case just pass the new item in
-this parameter. o : ObjectThe item to add. Returns: | MixedCollection |
| addAll( Object/Array objs )
- :
- voidAdds all elements of an Array or an Object to the collection. Adds all elements of an Array or an Object to the collection. | MixedCollection |
| addEvents( Object object )
- :
- voidUsed to define events on this Observable Used to define events on this Observable | Observable |
| addListener( String eventName , Function handler , [Object scope ], [Object options ] )
- :
+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. o : ObjectThe item to add. Returns: | MixedCollection |
| addAll( Object/Array objs )
+ :
+ voidAdds all elements of an Array or an Object to the collection. Adds all elements of an Array or an Object to the collection. Parameters:objs : Object/ArrayAn 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. Returns: | MixedCollection |
| addEvents( Object|String o , string Optional. )
+ :
+ voidAdds the specified events to the list of events which this Observable may fire. Adds the specified events to the list of events which this Observable may fire. | Observable |
| addListener( String eventName , Function handler , [Object scope ], [Object options ] )
+ :
voidAppends an event handler to this object. Appends an event handler to this object. Parameters:eventName : StringThe name of the event to listen for. handler : FunctionThe method the event invokes. 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.
properties. This may contain any of the following properties:
@@ -90,8 +97,8 @@ Using the options argument, it is possible to combine different types of listene
A delayed, one-time listener.
myDataView.on('click', this.onClick, this, {
- single: true,
- delay: 100
+single: true,
+delay: 100
});
Attaching multiple handlers in 1 call
@@ -99,93 +106,127 @@ The method also allows for a single argument to be passed which is a config obje
which specify multiple handlers.
myGridPanel.on({
- 'click' : {
- fn: this.onClick,
- scope: this,
- delay: 100
- },
- 'mouseover' : {
- fn: this.onMouseOver,
- scope: this
- },
- 'mouseout' : {
- fn: this.onMouseOut,
- scope: this
- }
+'click' : {
+ fn: this.onClick,
+ scope: this,
+ delay: 100
+},
+'mouseover' : {
+ fn: this.onMouseOver,
+ scope: this
+},
+'mouseout' : {
+ fn: this.onMouseOut,
+ scope: this
+}
});
Or a shorthand syntax:
myGridPanel.on({
- 'click' : this.onClick,
- 'mouseover' : this.onMouseOver,
- 'mouseout' : this.onMouseOut,
- scope: this
-});
Returns: | Observable |
| clear()
- :
- voidRemoves all items from the collection. Fires the clear event when complete. Removes all items from the collection. Fires the clear event when complete. | MixedCollection |
| clone()
- :
- MixedCollectionCreates a shallow copy of this collection Creates a shallow copy of this collection | MixedCollection |
| contains( Object o )
- :
- BooleanReturns true if the collection contains the passed Object as an item. Returns true if the collection contains the passed Object as an item. | MixedCollection |
| containsKey( String key )
- :
- BooleanReturns true if the collection contains the passed Object as a key. Returns true if the collection contains the passed Object as a key. | MixedCollection |
| each( Function fn , [Object scope ] )
- :
- voidExecutes the specified function once for every item in the collection, passing the following arguments:
+'click' : this.onClick,
+'mouseover' : this.onMouseOver,
+'mouseout' : this.onMouseOut,
+ scope: this
+}); Returns: | Observable |
| clear()
+ :
+ voidRemoves all items from the collection. Fires the clear event when complete. Removes all items from the collection. Fires the clear event when complete. | MixedCollection |
| clone()
+ :
+ MixedCollectionCreates a shallow copy of this collection Creates a shallow copy of this collection | MixedCollection |
| contains( Object o )
+ :
+ BooleanReturns true if the collection contains the passed Object as an item. Returns true if the collection contains the passed Object as an item. | MixedCollection |
| containsKey( String key )
+ :
+ BooleanReturns true if the collection contains the passed Object as a key. Returns true if the collection contains the passed Object as a key. | MixedCollection |
| each( Function fn , [Object scope ] )
+ :
+ voidExecutes the specified function once for every item in the collection, passing the following arguments:
<div class="... Executes the specified function once for every item in the collection, passing the following arguments:
-The function should return a boolean value. Returning false from the function will stop the iteration. | MixedCollection |
| eachKey( Function fn , [Object scope ] )
- :
- voidExecutes the specified function once for every key in the collection, passing each
+The function should return a boolean value. Returning false from the function will stop the iteration. | MixedCollection |
| eachKey( Function fn , [Object scope ] )
+ :
+ voidExecutes the specified function once for every key in the collection, passing each
key, and its associated item as t... Executes the specified function once for every key in the collection, passing each
-key, and its associated item as the first two parameters. | MixedCollection |
| enableBubble( Object events )
- :
- voidUsed to enable bubbling of events Used to enable bubbling of events | Observable |
| filter( String property , String/RegExp value , [Boolean anyMatch ], [Boolean caseSensitive ] )
- :
- MixedCollectionFilter the objects in this collection by a specific property.
+key, and its associated item as the first two parameters. | MixedCollection |
| enableBubble( Object events )
+ :
+ voidEnables events fired by this Observable to bubble up an owner hierarchy by calling
+this.getBubbleTarget() if present... 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.override(Ext.form.Field, {
+// Add functionality to Field's initComponent to enable the change event to bubble
+ initComponent: Ext.form.Field.prototype.initComponent.createSequence(function() {
+ this.enableBubble('change');
+ }),
+
+// We know that we want Field's events to bubble directly to the FormPanel.
+ getBubbleTarget: function() {
+ if (!this.formPanel) {
+ this.formPanel = this.findParentByType('form');
+ }
+ return this.formPanel;
+ }
+});
+
+var myForm = new Ext.formPanel({
+ title: 'User Details',
+ items: [{
+ ...
+ }],
+ listeners: {
+ change: function() {
+// Title goes red if form has been modified.
+ myForm.header.setStyle("color", "red");
+ }
+ }
+});
| Observable |
| filter( String property , String/RegExp value , [Boolean anyMatch ], [Boolean caseSensitive ] )
+ :
+ MixedCollectionFilter the objects in this collection by a specific property.
Returns a new collection that has been filtered. Filter the objects in this collection by a specific property.
Returns a new collection that has been filtered. Parameters:property : StringA property on your objects value : String/RegExpEither 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 caseSensitive : Boolean(optional) True for case sensitive comparison (defaults to False). Returns: | MixedCollection |
| filterBy( Function fn , [Object scope ] )
- :
- MixedCollectionFilter by a function. Returns a new collection that has been filtered.
+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 caseSensitive : Boolean(optional) True for case sensitive comparison (defaults to False). Returns: | MixedCollection |
| filterBy( Function fn , [Object scope ] )
+ :
+ MixedCollectionFilter by a function. Returns a new collection that has been filtered.
The passed function will be called with each ... 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. Parameters:fn : FunctionThe function to be called, it will receive the args o (the object), k (the key) scope : Object(optional) The scope of the function (defaults to this) Returns: | MixedCollection |
| find( Function fn , [Object scope ] )
- :
- ObjectReturns the first item in the collection which elicits a true return value from the
+If the function returns true, the value is included otherwise it is filtered. Parameters:fn : FunctionThe function to be called, it will receive the args o (the object), k (the key) scope : Object(optional) The scope of the function (defaults to this) Returns: | MixedCollection |
| find( Function fn , [Object scope ] )
+ :
+ ObjectReturns the first item in the collection which elicits a true return value from the
passed selection function. Returns the first item in the collection which elicits a true return value from the
-passed selection function. | MixedCollection |
| findIndex( String property , String/RegExp value , [Number start ], [Boolean anyMatch ], [Boolean caseSensitive ] )
- :
+passed selection function. | MixedCollection |
| findIndex( String property , String/RegExp value , [Number start ], [Boolean anyMatch ], [Boolean caseSensitive ] )
+ :
NumberFinds the index of the first matching object in this collection by a specific property/value. Finds the index of the first matching object in this collection by a specific property/value. Parameters:property : StringThe name of a property on your objects. value : String/RegExpA 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. caseSensitive : Boolean(optional) True for case sensitive comparison. Returns:Number The matched index or -1
| MixedCollection |
| findIndexBy( Function fn , [Object scope ], [Number start ] )
- :
- NumberFind the index of the first matching object in this collection by a function.
+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. caseSensitive : Boolean(optional) True for case sensitive comparison. Returns:Number The matched index or -1
| MixedCollection |
| findIndexBy( Function fn , [Object scope ], [Number start ] )
+ :
+ NumberFind the index of the first matching object in this collection by a function.
If the function returns true it is con... Find the index of the first matching object in this collection by a function.
-If the function returns true it is considered a match. Parameters:fn : FunctionThe function to be called, it will receive the args o (the object), k (the key). scope : Object(optional) The scope of the function (defaults to this). start : Number(optional) The index to start searching at (defaults to 0). Returns:Number The matched index or -1
| MixedCollection |
| fireEvent( String eventName , Object... args )
- :
- BooleanFires the specified event with the passed parameters (minus the event name).
+If the function returns true it is considered a match. Parameters:fn : FunctionThe function to be called, it will receive the args o (the object), k (the key). scope : Object(optional) The scope of the function (defaults to this). start : Number(optional) The index to start searching at (defaults to 0). Returns:Number The matched index or -1
| MixedCollection |
| fireEvent( String eventName , Object... args )
+ :
+ BooleanFires the specified event with the passed parameters (minus the event name).
An event may be set to bubble up an Obse... | Observable |
| first()
- :
- ObjectReturns the first item in the collection. Returns the first item in the collection. | MixedCollection |
| get( String/Number key )
- :
- ObjectThis method calls item().
-Returns the item associated with the passed key OR index. Key has priority over index. Th... This method calls item().
-Returns the item associated with the passed key OR index. Key has priority over index. This is the equivalent
-of calling key first, then if nothing matched calling itemAt. Parameters:Returns:Object If the item is found, returns the item. If the item was not found, returns <tt>undefined</tt>.
-If an item was found, but is a Class, returns <tt>null</tt>.
| MixedCollection |
| getCount()
- :
- NumberReturns the number of items in the collection. Returns the number of items in the collection. | MixedCollection |
| getKey( Object item )
- :
- ObjectMixedCollection has a generic way to fetch keys if you implement getKey. The default implementation
+by calling enableBubble. | Observable |
| first()
+ :
+ ObjectReturns the first item in the collection. Returns the first item in the collection. | MixedCollection |
| get( String/Number key )
+ :
+ ObjectThis method calls item().
+Returns the item associated with the passed key OR index. Key has priority
+over index. T... This method calls item().
+Returns the item associated with the passed key OR index. Key has priority
+over index. This is the equivalent of calling key first, then if
+nothing matched calling itemAt. Parameters:Returns:Object If the item is found, returns the item. If the item was
+not found, returns <tt>undefined</tt>. If an item was found, but is a Class,
+returns <tt>null</tt>.
| MixedCollection |
| getCount()
+ :
+ NumberReturns the number of items in the collection. Returns the number of items in the collection. | MixedCollection |
| getKey( Object item )
+ :
+ ObjectMixedCollection has a generic way to fetch keys if you implement getKey. The default implementation
simply returns ... MixedCollection has a generic way to fetch keys if you implement getKey. 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
+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);
@@ -204,70 +245,74 @@ mc.add(otherEl);
return el.dom.id;
});
mc.add(someEl);
-mc.add(otherEl);
| MixedCollection |
| getRange( [Number startIndex ], [Number endIndex ] )
- :
- ArrayReturns a range of items in this collection Returns a range of items in this collection | MixedCollection |
| hasListener( String eventName )
- :
- BooleanChecks to see if this object has any listeners for a specified event Checks to see if this object has any listeners for a specified event | Observable |
| indexOf( Object o )
- :
- NumberReturns index within the collection of the passed Object. Returns index within the collection of the passed Object. | MixedCollection |
| indexOfKey( String key )
- :
- NumberReturns index within the collection of the passed key. Returns index within the collection of the passed key. | MixedCollection |
| insert( Number index , String key , [Object o ] )
- :
- ObjectInserts an item at the specified index in the collection. Fires the add event when complete. Inserts an item at the specified index in the collection. Fires the add event when complete. Parameters:index : NumberThe index to insert the item at. key : StringThe key to associate with the new item, or the item itself. o : Object(optional) If the second parameter was a key, the new item. Returns: | MixedCollection |
| item( String/Number key )
- :
- ObjectReturns the item associated with the passed key OR index. Key has priority over index. This is the equivalent
-of ca... Returns the item associated with the passed key OR index. Key has priority over index. This is the equivalent
-of calling key first, then if nothing matched calling itemAt. Parameters:Returns:Object If the item is found, returns the item. If the item was not found, returns <tt>undefined</tt>.
-If an item was found, but is a Class, returns <tt>null</tt>.
| MixedCollection |
| itemAt( Number index )
- :
- ObjectReturns the item at the specified index. Returns the item at the specified index. Parameters:index : NumberThe index of the item. Returns: | MixedCollection |
| key( String/Number key )
- :
- ObjectReturns the item associated with the passed key. Returns the item associated with the passed key. Parameters:key : String/NumberThe key of the item. Returns: | MixedCollection |
| keySort( [String direction ], [Function fn ] )
- :
- voidSorts this collection by keys Sorts this collection by keys | MixedCollection |
| last()
- :
- ObjectReturns the last item in the collection. Returns the last item in the collection. | MixedCollection |
| on( String eventName , Function handler , [Object scope ], [Object options ] )
- :
+mc.add(otherEl); | MixedCollection |
| getRange( [Number startIndex ], [Number endIndex ] )
+ :
+ ArrayReturns a range of items in this collection Returns a range of items in this collection | MixedCollection |
| hasListener( String eventName )
+ :
+ BooleanChecks to see if this object has any listeners for a specified event Checks to see if this object has any listeners for a specified event | Observable |
| indexOf( Object o )
+ :
+ NumberReturns index within the collection of the passed Object. Returns index within the collection of the passed Object. | MixedCollection |
| indexOfKey( String key )
+ :
+ NumberReturns index within the collection of the passed key. Returns index within the collection of the passed key. | MixedCollection |
| insert( Number index , String key , [Object o ] )
+ :
+ ObjectInserts an item at the specified index in the collection. Fires the add event when complete. Inserts an item at the specified index in the collection. Fires the add event when complete. Parameters:index : NumberThe index to insert the item at. key : StringThe key to associate with the new item, or the item itself. o : Object(optional) If the second parameter was a key, the new item. Returns: | MixedCollection |
| item( String/Number key )
+ :
+ ObjectReturns the item associated with the passed key OR index.
+Key has priority over index. This is the equivalent
+of c... Returns the item associated with the passed key OR index.
+Key has priority over index. This is the equivalent
+of calling key first, then if nothing matched calling itemAt. Parameters:Returns:Object If the item is found, returns the item. If the item was not found, returns <tt>undefined</tt>.
+If an item was found, but is a Class, returns <tt>null</tt>.
| MixedCollection |
| itemAt( Number index )
+ :
+ ObjectReturns the item at the specified index. Returns the item at the specified index. Parameters:index : NumberThe index of the item. Returns: | MixedCollection |
| key( String/Number key )
+ :
+ ObjectReturns the item associated with the passed key. Returns the item associated with the passed key. Parameters:key : String/NumberThe key of the item. Returns: | MixedCollection |
| keySort( [String direction ], [Function fn ] )
+ :
+ voidSorts this collection by keys. Sorts this collection by keys. | MixedCollection |
| last()
+ :
+ ObjectReturns the last item in the collection. Returns the last item in the collection. | MixedCollection |
| on( String eventName , Function handler , [Object scope ], [Object options ] )
+ :
voidAppends an event handler to this object (shorthand for addListener.) Appends an event handler to this object (shorthand for addListener.) Parameters:eventName : StringThe type of event to listen for handler : FunctionThe method the event invokes 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. Returns: | Observable |
| purgeListeners()
- :
- voidRemoves all listeners for this object Removes all listeners for this object | Observable |
| relayEvents( Object o , Array events )
- :
- voidRelays selected events from the specified Observable as if the events were fired by this. Relays selected events from the specified Observable as if the events were fired by this. | Observable |
| remove( Object o )
- :
- ObjectRemove an item from the collection. Remove an item from the collection. Parameters:o : ObjectThe item to remove. Returns: | MixedCollection |
| removeAt( Number index )
- :
- ObjectRemove an item from a specified index in the collection. Fires the remove event when complete. Remove an item from a specified index in the collection. Fires the remove event when complete. | MixedCollection |
| removeKey( String key )
- :
- ObjectRemoved an item associated with the passed key fom the collection. Removed an item associated with the passed key fom the collection. | MixedCollection |
| removeListener( String eventName , Function handler , [Object scope ] )
- :
- voidRemoves an event handler. Removes an event handler. | Observable |
| replace( String key , o {Object} )
- :
+If omitted, defaults to the object which fired the event.options : Object(optional) An object containing handler configuration. Returns: | Observable |
| purgeListeners()
+ :
+ voidRemoves all listeners for this object Removes all listeners for this object | Observable |
| relayEvents( Object o , Array events )
+ :
+ voidRelays selected events from the specified Observable as if the events were fired by this. Relays selected events from the specified Observable as if the events were fired by this. | Observable |
| remove( Object o )
+ :
+ ObjectRemove an item from the collection. Remove an item from the collection. Parameters:o : ObjectThe item to remove. Returns: | MixedCollection |
| removeAt( Number index )
+ :
+ ObjectRemove an item from a specified index in the collection. Fires the remove event when complete. Remove an item from a specified index in the collection. Fires the remove event when complete. | MixedCollection |
| removeKey( String key )
+ :
+ ObjectRemoved an item associated with the passed key fom the collection. Removed an item associated with the passed key fom the collection. | MixedCollection |
| removeListener( String eventName , Function handler , [Object scope ] )
+ :
+ voidRemoves an event handler. Removes an event handler. | Observable |
| replace( String key , o {Object} )
+ :
ObjectReplaces an item in the collection. Fires the replace event when complete. Replaces an item in the collection. Fires the replace event when complete. | MixedCollection |
| resumeEvents()
- :
- voidResume firing events. (see suspendEvents)
-If events were suspended using the queueSuspended parameter, then all
+with that key. Returns: | MixedCollection |
| resumeEvents()
+ :
+ voidResume firing events. (see suspendEvents)
+If events were suspended using the queueSuspended parameter, then all
event... Resume 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. | Observable |
| sort( [String direction ], [Function fn ] )
- :
- voidSorts this collection with the passed comparison function Sorts this collection with the passed comparison function | MixedCollection |
| suspendEvents( Boolean queueSuspended )
- :
+events fired during event suspension will be sent to any listeners now. | Observable |
| sort( [String direction ], [Function fn ] )
+ :
+ voidSorts this collection by item value with the passed comparison function. Sorts this collection by item value with the passed comparison function. | MixedCollection |
| suspendEvents( Boolean queueSuspended )
+ :
voidSuspend the firing of all events. (see resumeEvents) Suspend the firing of all events. (see resumeEvents) Parameters:queueSuspended : BooleanPass as true to queue up suspended events to be fired
-after the resumeEvents call instead of discarding all suspended events; Returns: | Observable |
| un( String eventName , Function handler , [Object scope ] )
- :
- voidRemoves an event handler (shorthand for removeListener.) | Observable |