| Package: | Ext.util | 
| Class: | MixedCollection | 
| Extends: | Observable | 
| Defined In: | MixedCollection.js | 
| 方法 | 定义对象 | |
|---|---|---|
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. | ||
addEvents(Object object) : void | 
        Observable | |
| 将对象中没有的事件从给出的对象中复制过来。 | ||
addListener(String eventName, Function handler, [Object scope], [Object options]) : void | 
        Observable | |
| 为该组件加入事件处理器函数 | ||
| 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. | ||
fireEvent(String eventName, Object... args) : Boolean | 
        Observable | |
| 触发指定的事件, 并将参数传入(至少要有事件名称)。 | ||
| 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 | ||
hasListener(String eventName) : Boolean | 
        Observable | |
| 检查该对象是否拥有指定事件的侦听器 | ||
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. | ||
on(String eventName, Function handler, [Object options]) : void | 
        Observable | |
| 为该组件加入事件处理器函数, addListener 的简写方式 | ||
| purgeListeners() : void | Observable | |
| 从对象身上移除所有的侦听器 | ||
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. | ||
removeListener(String eventName, Function handler, [Object scope]) : void | 
        Observable | |
| 移除侦听器 | ||
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 | ||
un(String eventName, Function handler, [Object scope]) : void | 
        Observable | |
| 移除侦听器, removeListener 的简写方式 | ||
| 事件 | 定义对象 | |
|---|---|---|
add : (Number index, Object o, String key) | 
        MixedCollection | |
| Fires when an item is added to the collection. | ||
| clear : () | MixedCollection | |
| Fires when the collection is cleared. | ||
remove : (Object o, [String key]) | 
        MixedCollection | |
| Fires when an item is removed from the collection. | ||
replace : (String key, Object old, Object new) | 
        MixedCollection | |
| Fires when an item is replaced in the collection. | ||
public function MixedCollection(Boolean allowFunctions, Function keyFn)
                allowFunctions : BooleankeyFn : Functionpublic function add(String key, Object o)
                key : Stringo : ObjectObjectpublic function addAll(Object/Array objs)
                objs : Object/Arrayvoidpublic function addEvents(Object object)
                object : Objectvoidpublic function addListener(String eventName, Function handler, [Object scope], [Object options])
                eventName : Stringhandler : Functionscope : Objectoptions : Object
								组合选项
								使用选项参数可以组合不同类型的监听器:
								
								下面是一个标准的、延迟执行的、一次性的监听器,将会自动停止事件并传递一个自定义的参数(forumId)
el.on('click', this.onClick, this, { single: true, delay: 100, stopEvent : true, forumId: 4 }); 这个方法也允许传递的单个参数是一个包含多个指定处理函数的设置对象。
									一次调用多个处理函数
									代码:
el.on({ 'click' : { fn: this.onClick scope: this, delay: 100 }, 'mouseover' : { fn: this.onMouseOver scope: this }, 'mouseout' : { fn: this.onMouseOut scope: this } }); 或者简写为:
										代码:
el.on({ 'click' : this.onClick, 'mouseover' : this.onMouseOver, 'mouseout' : this.onMouseOut scope: this });
								voidpublic function clear()
                voidpublic function clone()
                MixedCollectionpublic function contains(Object o)
                o : ObjectBooleanpublic function containsKey(String key)
                key : StringBooleanpublic function each(Function fn, [Object scope])
                fn : Functionscope : Objectvoidpublic function eachKey(Function fn, [Object scope])
                fn : Functionscope : Objectvoidpublic function filter(String property, String/RegExp value)
                property : Stringvalue : String/RegExpMixedCollectionpublic function filterBy(Function fn, [Object scope])
                fn : Functionscope : ObjectMixedCollectionpublic function find(Function fn, [Object scope])
                fn : Functionscope : ObjectObjectpublic function fireEvent(String eventName, Object... args)
                eventName : Stringargs : Object...Booleanpublic function first()
                Objectpublic function get(String/Number key)
                key : String/NumberObjectpublic function getCount()
                Numberpublic function getKey(o {Object})
                // 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参数:返回:
{Object}: oThe item for which to find the key.
ObjectThe key for the passed item.
public function getRange([Number startIndex], [Number endIndex])
                startIndex : NumberendIndex : NumberArraypublic function hasListener(String eventName)
                eventName : StringBooleanpublic function indexOf(Object o)
                o : ObjectNumberpublic function indexOfKey(String key)
                key : StringNumberpublic function insert(Number index, String key, [Object o])
                index : Numberkey : Stringo : ObjectObjectpublic function item(String/Number key)
                key : String/NumberObjectpublic function itemAt(Number index)
                index : NumberObjectpublic function key(String/Number key)
                key : String/NumberObjectpublic function keySort([String direction], [Function fn])
                direction : Stringfn : Functionvoidpublic function last()
                Objectpublic function on(String eventName, Function handler, [Object options])
                eventName : Stringhandler : Functionoptions : Objectvoidpublic function purgeListeners()
                voidpublic function remove(Object o)
                o : ObjectObjectpublic function removeAt(Number index)
                index : Numbervoidpublic function removeKey(String key)
                key : Stringvoidpublic function removeListener(String eventName, Function handler, [Object scope])
                eventName : Stringhandler : Functionscope : Objectvoidpublic function replace(String key, [o {Object}])
                key : String{Object} : oObjectpublic function sort([String direction], [Function fn])
                direction : Stringfn : Functionvoidpublic function un(String eventName, Function handler, [Object scope])
                eventName : Stringhandler : Functionscope : Objectvoidpublic event add
                index : Numbero : Objectkey : Stringpublic event clear
                public event remove
                o : Objectkey : Stringpublic event replace
                key : Stringold : Objectnew : Object