ObservableMixedCollection
StoreMgr
| Package: | CQ.Ext |
| Class: | StoreMgr |
| Extends: | CQ.Ext.util.MixedCollection |
| Clientlib: | cq.widgets |
| Config Options | Defined By | |
|---|---|---|
|
allowFunctions : Boolean Specify true if the addAll function should add function references to the collection. Defaults to false.
Specify true if the addAll function should add function references to the collection. Defaults to false.
|
MixedCollection | |
| Property | Defined By | |
|---|---|---|
|
get : Object This method calls item().
Returns the item associated with the passed key OR index. Key has priority
over index. Thi...
|
MixedCollection | |
| Method | Defined By | |
|---|---|---|
add( String key, Object o ) : Object Adds an item to the collection. Fires the add event when complete.
Adds an item to the collection. Fires the add event when complete.
Parameters:
|
MixedCollection | |
addAll( Object/Array objs ) : void Adds all elements of an Array or an Object to the collection.
Adds all elements of an Array or an Object to the collection.
Parameters:
|
MixedCollection | |
| clear() : void | MixedCollection | |
|
clone() : MixedCollection Creates a shallow copy of this collection
Creates a shallow copy of this collection
Parameters:
|
MixedCollection | |
contains( Object o ) : Boolean Returns true if the collection contains the passed Object as an item.
Returns true if the collection contains the passed Object as an item.
Parameters:
|
MixedCollection | |
containsKey( String key ) : Boolean Returns true if the collection contains the passed Object as a key.
Returns true if the collection contains the passed Object as a key.
Parameters:
|
MixedCollection | |
each( Function fn, [Object scope] ) : void Executes the specified function once for every item in the collection, passing the following arguments:
item : Mixed...
Executes the specified function once for every item in the collection, passing the following arguments:
Parameters:
|
MixedCollection | |
eachKey( Function fn, [Object scope] ) : void Executes 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.
Parameters:
|
MixedCollection | |
enableBubble( String/Array events ) : void Enables 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 is commonly used by CQ.Ext.Components to bubble events to owner Containers. See CQ.Ext.Component.getBubbleTarget. The default implementation in CQ.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:
Parameters:
|
Observable | |
filter( String property, String/RegExp value, [Boolean anyMatch], [Boolean caseSensitive] ) : MixedCollection Filter 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:
|
MixedCollection | |
filterBy( Function fn, [Object scope] ) : MixedCollection Filter 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:
|
MixedCollection | |
find( Function fn, [Object scope] ) : Object Returns 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.
Parameters:
|
MixedCollection | |
findIndex( String property, String/RegExp value, [Number start], [Boolean anyMatch], [Boolean caseSensitive] ) : Number Finds 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:
|
MixedCollection | |
findIndexBy( Function fn, [Object scope], [Number start] ) : Number Find 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:
|
MixedCollection | |
|
first() : Object Returns the first item in the collection.
Returns the first item in the collection.
Parameters:
|
MixedCollection | |
|
getCount() : Number Returns the number of items in the collection.
Returns the number of items in the collection.
Parameters:
|
MixedCollection | |
getKey( Object item ) : Object MixedCollection 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:
Parameters:
|
MixedCollection | |
getRange( [Number startIndex], [Number endIndex] ) : Array Returns a range of items in this collection
Returns a range of items in this collection
Parameters:
|
MixedCollection | |
indexOf( Object o ) : Number Returns index within the collection of the passed Object.
Returns index within the collection of the passed Object.
Parameters:
|
MixedCollection | |
indexOfKey( String key ) : Number Returns index within the collection of the passed key.
Returns index within the collection of the passed key.
Parameters:
|
MixedCollection | |
insert( Number index, String key, [Object o] ) : Object 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:
|
MixedCollection | |
item( String/Number key ) : 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:
|
MixedCollection | |
itemAt( Number index ) : Object Returns the item at the specified index.
Returns the item at the specified index.
Parameters:
|
MixedCollection | |
key( String/Number key ) : Object Returns the item associated with the passed key.
Returns the item associated with the passed key.
Parameters:
|
MixedCollection | |
keySort( [String direction], [Function fn] ) : void Sorts this collection by keys.
Sorts this collection by keys.
Parameters:
|
MixedCollection | |
|
last() : Object Returns the last item in the collection.
Returns the last item in the collection.
Parameters:
|
MixedCollection | |
lookup( String/Object id ) : CQ.Ext.data.Store Gets a registered Store by id
Gets a registered Store by id
Parameters:
|
StoreMgr | |
register( CQ.Ext.data.Store store1, [CQ.Ext.data.Store store2], [CQ.Ext.data.Store etc...] ) : void
Registers one or more Stores with the StoreMgr. You do not normally need to register stores
manually. Any store ini...
Registers one or more Stores with the StoreMgr. You do not normally need to register stores
manually. Any store initialized with a CQ.Ext.data.Store.storeId will be auto-registered.
Parameters:
|
StoreMgr | |
relayEvents( Object o, Array events ) : void Relays 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.
Parameters:
|
Observable | |
remove( Object o ) : Object Remove an item from the collection.
Remove an item from the collection.
Parameters:
|
MixedCollection | |
removeAt( Number index ) : Object Remove 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.
Parameters:
|
MixedCollection | |
removeKey( String key ) : Object Removed an item associated with the passed key fom the collection.
Removed an item associated with the passed key fom the collection.
Parameters:
|
MixedCollection | |
reorder( Object mapping ) : void Reorders each of the items based on a mapping from old index to new index. Internally this
just translates into a sor...
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 occured.
Parameters:
|
MixedCollection | |
replace( String key, [Object o] ) : 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.
Parameters:
|
MixedCollection | |
sort( [String direction], [Function fn] ) : void Sorts this collection by item value with the passed comparison function.
Sorts this collection by item value with the passed comparison function.
Parameters:
|
MixedCollection | |
unregister( String/Object id1, [String/Object id2], [String/Object etc...] ) : void Unregisters one or more Stores with the StoreMgr
Unregisters one or more Stores with the StoreMgr
Parameters:
|
StoreMgr | |
| Event | Defined By | |
|---|---|---|
add : ( Number index, Object o, String key ) Fires when an item is added to the collection.
Fires when an item is added to the collection.
Listeners will be called with the following arguments:
|
MixedCollection | |
|
clear : () Fires when the collection is cleared.
Fires when the collection is cleared.
Listeners will be called with the following arguments:
|
MixedCollection | |
remove : ( Object o, [String key] ) Fires when an item is removed from the collection.
Fires when an item is removed from the collection.
Listeners will be called with the following arguments:
|
MixedCollection | |
replace : ( String key, Object old, Object new ) Fires when an item is replaced in the collection.
Fires when an item is replaced in the collection.
Listeners will be called with the following arguments:
|
MixedCollection | |