A Collection class that maintains both numeric indexes and keys and exposes events.
This class has no public properties.
|
MixedCollection(Boolean allowFunctions , Function keyFn ) |
MixedCollection |
|
|
add(String key , Object o ) : Object |
MixedCollection |
Adds an item to the collection. |
|
addAll(Object/Array objs ) : void |
MixedCollection |
Adds all elements of an Array or an Object to the collection. |
|
clear() : void |
MixedCollection |
Removes all items from the collection. |
|
clone() : MixedCollection |
MixedCollection |
Creates a duplicate of this collection |
|
contains(Object o ) : Boolean |
MixedCollection |
Returns true if the collection contains the passed Object as an item. |
|
containsKey(String key ) : Boolean |
MixedCollection |
Returns true if the collection contains the passed Object as a key. |
|
each(Function fn , [Object scope ]) : void |
MixedCollection |
Executes the specified function once for every item in the collection, passing each
item as the first and only parame... |
|
eachKey(Function fn , [Object scope ]) : void |
MixedCollection |
Executes the specified function once for every key in the collection, passing each
key, and its associated item as th... |
|
filter(String property , String/RegExp value ) : MixedCollection |
MixedCollection |
Filter the objects in this collection by a specific property.
Returns a new collection that has been filtered. |
|
filterBy(Function fn , [Object scope ]) : MixedCollection |
MixedCollection |
Filter by a function. * Returns a new collection that has been filtered.
The passed function will be called with each... |
|
find(Function fn , [Object scope ]) : Object |
MixedCollection |
Returns the first item in the collection which elicits a true return value from the
passed selection function. |
|
first() : Object |
MixedCollection |
Returns the first item in the collection. |
|
get(String/Number key ) : Object |
MixedCollection |
Returns the item associated with the passed key or index. |
|
getCount() : Number |
MixedCollection |
Returns the number of items in the collection. |
|
getKey(o {Object} ) : Object |
MixedCollection |
MixedCollection has a generic way to fetch keys if you implement getKey.
// normal way
var mc = new E... |
|
getRange([Number startIndex ], [Number endIndex ]) : Array |
MixedCollection |
Returns a range of items in this collection |
|
indexOf(Object o ) : Number |
MixedCollection |
Returns index within the collection of the passed Object. |
|
indexOfKey(String key ) : Number |
MixedCollection |
Returns index within the collection of the passed key. |
|
insert(Number index , String key , [Object o ]) : Object |
MixedCollection |
Inserts an item at the specified index in the collection. |
|
item(String/Number key ) : Object |
MixedCollection |
Returns the item associated with the passed key OR index. Key has priority over index. |
|
itemAt(Number index ) : Object |
MixedCollection |
Returns the item at the specified index. |
|
key(String/Number key ) : Object |
MixedCollection |
Returns the item associated with the passed key. |
|
keySort([String direction ], [Function fn ]) : void |
MixedCollection |
Sorts this collection by keys |
|
last() : Object |
MixedCollection |
Returns the last item in the collection. |
|
remove(Object o ) : Object |
MixedCollection |
Removed an item from the collection. |
|
removeAt(Number index ) : void |
MixedCollection |
Remove an item from a specified index in the collection. |
|
removeKey(String key ) : void |
MixedCollection |
Removed an item associated with the passed key fom the collection. |
|
replace(String key , [o {Object} ]) : Object |
MixedCollection |
Replaces an item in the collection. |
|
sort([String direction ], [Function fn ]) : void |
MixedCollection |
Sorts this collection with the passed comparison function |
add
public function add(String key
, Object o
)
Adds an item to the collection.
This method is defined by MixedCollection.
addAll
public function addAll(Object/Array objs
)
Adds all elements of an Array or an Object to the collection.
This method is defined by MixedCollection.
clear
public function clear()
Removes all items from the collection.
This method is defined by MixedCollection.
clone
public function clone()
Creates a duplicate of this collection
This method is defined by MixedCollection.
contains
public function contains(Object o
)
Returns true if the collection contains the passed Object as an item.
This method is defined by MixedCollection.
containsKey
public function containsKey(String key
)
Returns true if the collection contains the passed Object as a key.
This method is defined by MixedCollection.
each
public function each(Function fn
, [Object scope
])
Executes the specified function once for every item in the collection, passing each
item as the first and only parameter. returning false from the function will stop the iteration.
This method is defined by MixedCollection.
eachKey
public function eachKey(Function fn
, [Object scope
])
Executes the specified function once for every key in the collection, passing each
key, and its associated item as the first two parameters.
This method is defined by MixedCollection.
filter
public function filter(String property
, String/RegExp value
)
Filter the
objects in this collection by a specific property.
Returns a new collection that has been filtered.
This method is defined by MixedCollection.
filterBy
public function filterBy(Function fn
, [Object scope
])
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:
This method is defined by MixedCollection.
find
public function find(Function fn
, [Object scope
])
Returns the first item in the collection which elicits a true return value from the
passed selection function.
This method is defined by MixedCollection.
first
public function first()
Returns the first item in the collection.
This method is defined by MixedCollection.
get
public function get(String/Number key
)
Returns the item associated with the passed key or index.
This method is defined by MixedCollection.
getCount
public function getCount()
Returns the number of items in the collection.
This method is defined by MixedCollection.
getKey
public function getKey(o {Object}
)
MixedCollection has a generic way to fetch keys if you implement getKey.
// 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);
// etc
This method is defined by MixedCollection.
getRange
public function getRange([Number startIndex
], [Number endIndex
])
Returns a range of items in this collection
This method is defined by MixedCollection.
indexOf
public function indexOf(Object o
)
Returns index within the collection of the passed Object.
This method is defined by MixedCollection.
indexOfKey
public function indexOfKey(String key
)
Returns index within the collection of the passed key.
This method is defined by MixedCollection.
insert
public function insert(Number index
, String key
, [Object o
])
Inserts an item at the specified index in the collection.
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:
This method is defined by MixedCollection.
item
public function item(String/Number key
)
Returns the item associated with the passed key OR index. Key has priority over index.
This method is defined by MixedCollection.
itemAt
public function itemAt(Number index
)
Returns the item at the specified index.
Parameters:
index
: NumberThe index of the item.
Returns:
This method is defined by MixedCollection.
key
public function key(String/Number key
)
Returns the item associated with the passed key.
Parameters:
key
: String/NumberThe key of the item.
Returns:
This method is defined by MixedCollection.
keySort
public function keySort([String direction
], [Function fn
])
Sorts this collection by keys
This method is defined by MixedCollection.
last
public function last()
Returns the last item in the collection.
This method is defined by MixedCollection.
remove
public function remove(Object o
)
Removed an item from the collection.
Parameters:
o
: ObjectThe item to remove.
Returns:
This method is defined by MixedCollection.
removeAt
public function removeAt(Number index
)
Remove an item from a specified index in the collection.
This method is defined by MixedCollection.
removeKey
public function removeKey(String key
)
Removed an item associated with the passed key fom the collection.
This method is defined by MixedCollection.
replace
public function replace(String key
, [o {Object}
])
Replaces an item in the collection.
Parameters:
key
: StringThe key associated with the item to replace, or the item to replace.
{Object}
: oo (optional) If the first parameter passed was a key, the item to associate with that key.
Returns:
This method is defined by MixedCollection.
sort
public function sort([String direction
], [Function fn
])
Sorts this collection with the passed comparison function
This method is defined by MixedCollection.