wire.Collection
A collection is a basic programming structure that allows an array of objects to be maintained using a field as a unique key.
The following creates a new Collection
object from users
using the UserName
field as the key. The first parameter to the constructor is the key field and the second is the array of objects.
Use the following methods to maintain a collection of users.
Methods
Name
Description
array
Returns the array of objects inside the collection.
clear
Clears the collections array.
get(value)
Returns the object with the key value value
.
index(value)
Returns the 0 index position of the object with the key value value
.
length
Returns the length of the internal array.
move(fromIndex, toIndex)
Moves on object inside the collection from 0 index position fromIndex
to toIndex
.
remove(key)
Removes the object with the key value value
.
set(object)
Adds the object to the collection. If the object already exists with the existing key field value, it replaces the current one in the collection. If not, it is added to the collection at the end.
For more examples on using WireBootstrap collections, visit Collections.
Last updated