Represents a JSON-based list model, i.e. a model that allows its contents to be specified using the XML representation of a data structure equivalent to JSON.
See also List Model API and Working with JSON.
n/a
The ui:list-model element represents a JSON-based list model.
This component is provided by the V$.UI.ListModel class. The class implements the List Model API and defines the following additional methods:
Initializes the list model with the array of items.
The first method does not change the model; it simply fires a cf2:listItemsChanged event indicating that the range of items has changed. It should be used when the underlying data in the model has already been changed, e.g. by modifying an object within the model. It is an error if the following constraints are not satisfied:
from >= 0
from <= to. Please note that if from = to, then nothing has changed and so no event is fired.
to <= the total number of items in the model
The second method should be used to change the items in the model. It is equivalent to replaceItems(from, items) except that this method fires a cf2:listItemsChanged event instead of cf2:listItemsReplaced.
The third method should be used when all the items in the model have been changed. It is equivalent to removing all the existing items and then inserting the new items except that this method fires a single cf2:listItemsChanged event.
Parameter | Description | Type |
---|---|---|
from | The index of the start of the range that has changed (inclusive). | Integer |
items | The array of items to change. If this is empty, then the model is not changed and no event is fired. | any[] |
to | The index of the end of the range that has changed (exclusive). | Integer |
Replaces the existing items in the model with different items and then fires a cf2:listItemsReplaced event. The following constraints must be satisfied:
from >= 0
from + items.length < the total number of items in the model
Parameter | Description | Type |
---|---|---|
from | The index of the start of the range that has changed (inclusive). | Integer |
items | The array of items to replace. If this is empty, then the model is not changed and no event is fired. | any[] |
Inserts additional items into the model and then fires a cf2:listItemsInserted event. The items are inserted before the item at the index from. The following constraints must be satisfied:
from >= 0
from <= the total number of items in the model
Parameter | Description | Type |
---|---|---|
from | The index of the first item that will change. | Integer |
items | The array of items to insert. If this is empty, then the model is not changed and no event is fired. | any[] |
Appends the items to the end of the model.
Parameter | Description | Type |
---|---|---|
items | The array of items to append. If this is empty, then the model is not changed and no event is fired. | any[] |
Moves the items in the model and then fires a cf2:listItemsMoved event. It behaves as if the items in the range [from, from + count) were removed and then inserted at to. It is an error if the following constraints are not satisfied:
count >= 0
from >= 0
from + count <= the total number of items in the model
to >= 0
to + count <= the total number of items in the model
Parameter | Description | Type |
---|---|---|
from | The index of the first item to move. | Integer |
to | The index of the destination of the move. | Integer |
count | The number of items to move. | Integer |
from >= 0
from <= to. If from = to, then nothing is removed and so no event is fired.
to <= the total number of items in the model
Parameter | Description | Type |
---|---|---|
from | The index of the start of the range to remove (inclusive). | Integer |
to | The index of the end of the range to remove (exclusive). | Integer |