|
| MixedCollection( Boolean allowFunctions , Function keyFn )
- | 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 )
+ 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 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. | MixedCollection |
| addEvents( Object object )
+ 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. )
:
- voidUsed to define events on this Observable Used to define events on this Observable | Observable |
| addListener( String eventName , Function handler , [Object scope ], [Object options ] )
+ 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.
@@ -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,27 +106,27 @@ 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
+'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()
@@ -130,41 +137,73 @@ Or a shorthand syntax:
:
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
-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.
-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. | 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 th... 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( String/Array 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.
-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 ] )
+ MixedCollectionFilter by a function. Returns a new collection that has been filtered.
+The passed function will be called with each o... 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 (this reference) in which the function is executed. Defaults to this MixedCollection. 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 ] )
+ 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 ] )
:
- 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. | 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 )
+ NumberFind the index of the first matching object in this collection by a function.
+If the function returns true it is cons... 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 (this reference) in which the function is executed. Defaults to this MixedCollection. 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... | 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()
+ ObjectThis method calls item().
+Returns the item associated with the passed key OR index. Key has priority
+over index. Thi... 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
-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();
-mc.getKey = function(el){
- return el.dom.id;
-};
-mc.add(someEl);
-mc.add(otherEl);
-
-// or via the constructor
-var mc = new Ext.util.MixedCollection(false, function(el){
- return el.dom.id;
-});
-mc.add(someEl);
+ ObjectMixedCollection has a generic way to fetch keys if you implement getKey. The default implementation
+simply returns i... 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
+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();
+mc.getKey = function(el){
+ return el.dom.id;
+};
+mc.add(someEl);
+mc.add(otherEl);
+
+// or via the constructor
+var mc = new Ext.util.MixedCollection(false, function(el){
+ 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 )
+ 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 )
:
@@ -216,16 +257,19 @@ mc.add(otherEl);Parameters:Inserts 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>.
+ Object Returns the item associated with the passed key OR index.
+Key has priority over index. This is the equivalent
+of cal... 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()
+ 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 ] )
:
@@ -244,11 +288,11 @@ If an item was found, but is a Class, returns <tt>null</tt>.
:
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. Parameters:key : StringThe 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. {Object} : oo (optional) If the first parameter passed was a key, the item to associate
+ Object Replaces 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)
@@ -257,7 +301,8 @@ event... | 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 )
+ 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 ] )
|