| Package | qnx.ui.data |
| Interface | public interface IDataProvider extends flash.events.IEventDispatcher |
| Implementors | DataProvider |
DataProvider class.
See also
| Property | Defined By | ||
|---|---|---|---|
| data : Array [read-only]
Returns the Array of item data. | IDataProvider | ||
| length : int [read-only]
Returns the length of the data. | IDataProvider | ||
| Method | Defined By | ||
|---|---|---|---|
addItem(item:Object):void
Adds an item to the DataProvider. | IDataProvider | ||
addItemAt(item:Object, index:int):void
Adds an item at the specified index. | IDataProvider | ||
addItemsAt(items:Array, index:int):void
Adds an array item at the specified index. | IDataProvider | ||
Clones the DataProvider instance. | IDataProvider | ||
getItemAt(index:int):Object
Returns the item at a given offset. | IDataProvider | ||
indexOf(obj:Object):int
Returns the index of a given object. | IDataProvider | ||
removeAll():void
Removes all items from the DataProvider instance. | IDataProvider | ||
removeItem(item:Object):void
Removes the item from the DataProvider instance. | IDataProvider | ||
removeItemAt(index:int):void
Removes an item from the DataProvider at a given offset. | IDataProvider | ||
replaceItem(item:Object, oldObject:Object):void
Replaces an item, given the new item object and the item to replace. | IDataProvider | ||
replaceItemAt(item:Object, index:int):void
Replaces the item at a given offset. | IDataProvider | ||
setItems(arr:Array, throwEvent:Boolean = false):void
Sets the entire data provider to the new array. | IDataProvider | ||
updateItem(item:Object, oldObject:Object):void
Updates an item, given the new item data object and the item to update. | IDataProvider | ||
updateItemAt(item:Object, index:int):void
Updates the item at a given offset. | IDataProvider | ||
updateItemsAt(items:Array, index:int):void
Updates the items starting at the specified index with new items. | IDataProvider | ||
| data | property |
data:Array [read-only] Returns the Array of item data.
public function get data():Array| length | property |
length:int [read-only] Returns the length of the data.
public function get length():int| addItem | () | method |
public function addItem(item:Object):void
Adds an item to the DataProvider. The item is added to the end of the DataProvider.
In the following example, a new object is created and added to a List. The object is instantiated, and the
label property is set. By default, the List object uses the label property of each item to render the item labels in
the List.
var myObj:Object = new Object();
myObj.label = "Bread";
myList.addItem(myObj);
Parameters
item:Object — The item object to add.
|
See also
| addItemAt | () | method |
public function addItemAt(item:Object, index:int):voidAdds an item at the specified index.
The following listing adds an object with the label "December" to the fifth index position of the DataProvider.
myDP.addItemAt({label: "December"}, 5);
Parameters
item:Object — The item object to add.
| |
index:int — The index, or offset, at which to add the item.
|
RangeError — Thrown if the specified index is less than 0, or greater than or equal to the length of the DataProvider.
|
See also
| addItemsAt | () | method |
public function addItemsAt(items:Array, index:int):voidAdds an array item at the specified index.
In the following listing, an Array is created and added to a List at the third index position.
var myArr:Array = new Array();
myArr.push({label: "Juice"}, {label: "Tooth paste"}, {label: "Soap"});
myList.addItemsAt(myArr, 3);
Parameters
items:Array — The array of items to add.
| |
index:int — The index, or offset, at which to add the items.
|
RangeError — Thrown if the specified index is less than 0, or greater than or equal to the length of the DataProvider.
|
See also
| clone | () | method |
public function clone():IDataProvider
Clones the DataProvider instance.
IDataProvider — A new DataProvider instance.
|
| getItemAt | () | method |
public function getItemAt(index:int):ObjectReturns the item at a given offset.
Parameters
index:int — The offset of the item to return.
|
Object — The item object.
|
RangeError — Thrown if the specified index is less than 0, or greater than or equal to the length of the DataProvider.
|
| indexOf | () | method |
public function indexOf(obj:Object):intReturns the index of a given object.
Parameters
obj:Object — The object for which to return the index.
|
int — The index of the object. Returns -1 if the item is not found in the DataProvider.
|
| removeAll | () | method |
public function removeAll():void
Removes all items from the DataProvider instance.
See also
| removeItem | () | method |
public function removeItem(item:Object):void
Removes the item from the DataProvider instance.
Parameters
item:Object — The item to remove.
|
RangeError — Thrown if the specified index is less than 0, or greater than or equal to the length of the DataProvider.
|
See also
| removeItemAt | () | method |
public function removeItemAt(index:int):void
Removes an item from the DataProvider at a given offset.
The following example removes the first item in the DataProvider.
myList.removeItemAt(0);
Parameters
index:int — The offset of the item to remove.
|
RangeError — Thrown if the specified index is less than 0, or greater than or equal to the length of the DataProvider.
|
See also
| replaceItem | () | method |
public function replaceItem(item:Object, oldObject:Object):voidReplaces an item, given the new item object and the item to replace.
Parameters
item:Object — The new item object data.
| |
oldObject:Object — The item to replace.
|
RangeError — Thrown if the specified index is less than 0, or greater than or equal to the length of the DataProvider.
|
See also
| replaceItemAt | () | method |
public function replaceItemAt(item:Object, index:int):voidReplaces the item at a given offset.
In the following example, the first item in the DataProvider is replaced with a new item.
myList.replaceItemAt(myObj, 0);
Parameters
item:Object — The new item object.
| |
index:int — The offset of the item to replace.
|
RangeError — Thrown if the specified index is less than 0, or greater than or equal to the length of the DataProvider.
|
See also
| setItems | () | method |
public function setItems(arr:Array, throwEvent:Boolean = false):voidSets the entire data provider to the new array.
The following listing creates an array of objects and applies the array to the
DataProvider using the setItems() method.
var arrMonth:Array=[];
arrMonth.push({label: "January"});
arrMonth.push({label: "February"});
arrMonth.push({label: "March"});
arrMonth.push({label: "April"});
arrMonth.push({label: "May"});
arrMonth.push({label: "June"});
arrMonth.push({label: "July"});
arrMonth.push({label: "August"});
arrMonth.push({label: "September"});
arrMonth.push({label: "October"});
arrMonth.push({label: "November"});
arrMonth.push({label: "December"});
var myDP:DataProvider = new DataProvider();
myDP.setItems(arrMonth);
Parameters
arr:Array — An Array of new values.
| |
throwEvent:Boolean (default = false) — When set to true, a DataProviderEvent.UPDATE_ALL event is fired. The default is false.
|
| updateItem | () | method |
public function updateItem(item:Object, oldObject:Object):voidUpdates an item, given the new item data object and the item to update.
Parameters
item:Object — The new item.
| |
oldObject:Object — The item to update.
|
| updateItemAt | () | method |
public function updateItemAt(item:Object, index:int):voidUpdates the item at a given offset.
Parameters
item:Object — The new item object data.
| |
index:int — The offset at which to update the item.
|
RangeError — Thrown if the specified index is less than 0, or greater than or equal to the length of the DataProvider.
|
See also
| updateItemsAt | () | method |
public function updateItemsAt(items:Array, index:int):voidUpdates the items starting at the specified index with new items.
Parameters
items:Array — The new items to be updated.
| |
index:int — The start index to update the items
|
RangeError — Thrown if the specified index is less than 0, or greater than or equal to the length of the DataProvider.
|
See also