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 IHierarchicalCollection.updateItem() is called.

feathers.events.FlatCollectionEvent.UPDATE_ALL

Dispatched when IHierarchicalCollection.updateAll() is called.

feathers.events.FlatCollectionEvent.FILTER_CHANGE

Dispatched when IFlatCollection.filterFunction is changed.

feathers.events.FlatCollectionEvent.SORT_CHANGE

Dispatched when IFlatCollection.sortCompareFunction is changed.

Available since

1.0.0

.

Constructor

new(?array:Array<T>)

Creates a new ArrayCollection object with the given arguments.

Available since

1.0.0

.

Variables

@:bindable("reset")array:Array<T>

The Array data source for this collection.

The following example replaces the data source with a new array:

collection.array = [];
Available since

1.0.0

.

@:bindable("change")read onlylength:Int

@:bindable("filterChange")filterFunction:T ‑> Bool

@:bindable("sortChange")sortCompareFunction:(T, T) ‑> Int

Methods

addAllAt(collection:IFlatCollection<T>, index:Int):Void

addAt(item: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.

Available since

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.

Available since

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.

Available since

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.

Available since

1.0.0

.

@:bindable("change")get(index:Int):T

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.

Available since

1.0.0

.

@:value({ collection : null })reset(?collection:IFlatCollection<T>):Void

set(index:Int, item:T):Void

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.

Available since

1.0.0

.

toArray():Array<T>

Returns a new array containing the items in the collection, honoring the current filter and sort, if any.

Available since

1.0.0

.