class ArrayCollection<T>
package feathers.data
extends EventDispatcher
implements IExternalizable, IFlatCollection<T>
Wraps an Array
in the common IFlatCollection
API used for data
collections by many Feathers UI controls, including ListView
and TabBar
.
Events:
openfl.events.Event.CHANGE | Dispatched when the collection changes. |
---|---|
feathers.events.FlatCollectionEvent.ADD_ITEM | Dispatched when an item is added to the collection. |
feathers.events.FlatCollectionEvent.REMOVE_ITEM | Dispatched when an item is removed from the collection. |
feathers.events.FlatCollectionEvent.REPLACE_ITEM | Dispatched when an item is replaced in the collection. |
feathers.events.FlatCollectionEvent.REMOVE_ALL | Dispatched when all items are removed from the collection. |
feathers.events.FlatCollectionEvent.RESET | Dispatched when the source of the collection is changed. |
feathers.events.FlatCollectionEvent.UPDATE_ITEM | Dispatched
when |
feathers.events.FlatCollectionEvent.UPDATE_ALL | Dispatched
when |
feathers.events.FlatCollectionEvent.FILTER_CHANGE | Dispatched
when |
feathers.events.FlatCollectionEvent.SORT_CHANGE | Dispatched
when |
1.0.0
.Constructor
new(?array:Array<T>)
Creates a new ArrayCollection
object with the given arguments.
1.0.0
.Variables
array:Array<T>
The Array
data source for this collection.
The following example replaces the data source with a new array:
collection.array = [];
1.0.0
.Methods
addAllAt(collection:IFlatCollection<T>, index:Int):Void
every(callback:(item:T, index:Int, collection:ArrayCollection<T>) ‑> Bool):Bool
Using a callback that returns either true
or false
, determines if
at least one item in the collection returns true
.
1.0.0
.find(callback:(item:T, index:Int, collection:ArrayCollection<T>) ‑> Bool):T
Using a callback that returns either true
or false
, returns the
first item in the collection where the callback returns true
.
1.0.0
.findIndex(callback:(item:T, index:Int, collection:ArrayCollection<T>) ‑> Bool):Int
Using a callback that returns either true
or false
, returns the
first item in the collection where the callback returns true
.
1.0.0
.forEach(callback:(item:T, index:Int, collection:ArrayCollection<T>) ‑> Void):Void
Iterates through every item in the collection and passes it to a callback.
1.0.0
.map<U>(callback:(item:T, index:Int, collection:ArrayCollection<T>) ‑> U):ArrayCollection<U>
Creates a new collection using a callback for each item in the existing collection.
1.0.0
.some(callback:(item:T, index:Int, collection:ArrayCollection<T>) ‑> Bool):Bool
Using a callback that returns either true
or false
, determines if
at all items in the collection return true
.
1.0.0
.toArray():Array<T>
Returns a new array containing the items in the collection, honoring the current filter and sort, if any.
1.0.0
.