Paket | mx.collections |
Sınıf | public class AsyncListView |
Miras Alma | AsyncListView OnDemandEventDispatcher Object |
Uygular | IList |
Dil Sürümü: | ActionScript 3.0 |
Ürün Sürümü: | Flex 4 |
Çalışma Zamanı Sürümleri: | Flash Player 10, AIR 1.5 |
getItemAt()
, removeItemAt()
,
and toArray()
methods.
The getItemAt()
method handles ItemPendingErrors by returning a provisional
"pending" item until the underlying request succeeds or fails. The provisional
item is produced by calling the function specified by the createPendingItemFunction
property. . If the request
succeeds, the actual item replaces the provisional one.
If it fails, the provisional item is replaced with the item returned by calling
the function specified by the createFailedItemFunction
property.
This class delegates the IList methods and properties to its list
.
If a list isn't specified, methods that mutate the collection are no-ops,
and methods that query the collection return an empty value, such as null or zero
as appropriate.
This class is intended to be used with Spark components based on DataGroup, such as List and ComboBox. The Spark classes do not provide intrinsic support for ItemPendingError handling.
AsyncListView does not support re-insertion of pending or failed items. Once a failed or pending item is removed, its connection to a pending request for data is lost. Using drag and drop to move a pending item in an ASyncListView, or sorting an ASyncListView that contains pending or failed items, is not supported because these operations remove and then re-insert list items.
MXML SözdizimiMXML Sözdizimini GizleThe <mx:AsyncListView>
tag inherits all the attributes of its
superclass, and adds the following attributes:
<mx:AsyncListView Properties createFailedItemFunction="null" createPendingItemFunction="null" list="null" />
Özellik | Tanımlayan: | ||
---|---|---|---|
constructor : Object
Belirli bir nesne örneği için sınıf nesnesine veya yapıcı işlevine bir başvuru. | Object | ||
createFailedItemFunction : Function
A callback function used to create a substitute item when
a request which had caused an ItemPendingError to be thrown,
subsequently fails. | AsyncListView | ||
createPendingItemFunction : Function
A callback function used to create a provisional item when
the initial request causes an ItemPendingError to be thrown. | AsyncListView | ||
length : int [salt okunur]
The number of items in this collection. | AsyncListView | ||
list : IList
The IList object that this collection wraps. | AsyncListView |
Yöntem | Tanımlayan: | ||
---|---|---|---|
AsyncListView(list:IList = null)
Constructor. | AsyncListView | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener
receives notification of an event. | OnDemandEventDispatcher | ||
Adds the specified item to the end of the list. | AsyncListView | ||
Adds the item at the specified index. | AsyncListView | ||
Dispatches an event into the event flow. | OnDemandEventDispatcher | ||
Returns the value of list.getItemAt(index). | AsyncListView | ||
Returns the index of the item if it is in the list such that
getItemAt(index) == item. | AsyncListView | ||
Checks whether the EventDispatcher object has any listeners registered for a specific type
of event. | OnDemandEventDispatcher | ||
Bir nesnenin belirli bir özelliğinin tanımlı olup olmadığını gösterir. | Object | ||
Object sınıfının bir örneğinin parametre olarak belirtilen nesnenin prototip zincirinde olup olmadığını gösterir. | Object | ||
itemUpdated(item:Object, property:Object = null, oldValue:Object = null, newValue:Object = null):void
Notifies the view that an item has been updated. | AsyncListView | ||
Belirtilen özelliğin bulunup bulunmadığını ve numaralandırılabilir olup olmadığını gösterir. | Object | ||
Removes all items from the list. | AsyncListView | ||
Removes a listener from the EventDispatcher object. | OnDemandEventDispatcher | ||
Removes the actual or pending item at the specified index and returns it. | AsyncListView | ||
Places the item at the specified index. | AsyncListView | ||
Dinamik bir özelliğin döngü işlemlerinde kullanılabilirliğini ayarlar. | Object | ||
Returns an array with the same elements as this AsyncListView. | AsyncListView | ||
Bu nesnenin, yerel ayara özel kurallara göre biçimlendirilmiş dize temsilini döndürür. | Object | ||
Returns a string that contains the list's length and the number of pending item requests. | AsyncListView | ||
Belirtilen nesnenin temel değerini döndürür. | Object | ||
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type. | OnDemandEventDispatcher |
Olay | Özet | Tanımlayan: | ||
---|---|---|---|---|
Dispatched when the list's length has changed or when a list element is replaced. | AsyncListView |
createFailedItemFunction | özellik |
createFailedItemFunction:Function
Dil Sürümü: | ActionScript 3.0 |
Ürün Sürümü: | Flex 4 |
Çalışma Zamanı Sürümleri: | Flash Player 10, AIR 1.5 |
A callback function used to create a substitute item when
a request which had caused an ItemPendingError
to be thrown,
subsequently fails. The existing item, typically a pending item created
by the callback function specified by the createPendingItemFunction()
property,
is replaced with the failed item.
The value of this property must be a function with two parameters: the index
of the requested item, and the failure "info" object, which is
passed along from the IResponder fault()
method.
In most cases you can ignore the second parameter.
Shown below is an example implementation of the callback function:
function createFailedItem(index:int, info:Object):Object { return "[" + index + "request failed]"; }
Setting this property does not affect failed items that were already created. Setting this property to null prevents failed items from being created.
Varsayılan değer şudur A function that unconditionally returns null..
Uygulama
public function get createFailedItemFunction():Function
public function set createFailedItemFunction(value:Function):void
İlgili API Öğeleri
createPendingItemFunction | özellik |
createPendingItemFunction:Function
Dil Sürümü: | ActionScript 3.0 |
Ürün Sürümü: | Flex 4 |
Çalışma Zamanı Sürümleri: | Flash Player 10, AIR 1.5 |
A callback function used to create a provisional item when
the initial request causes an ItemPendingError
to be thrown.
If the request eventually succeeds, the provisional item is automatically
replaced by the actual item. If the request fails, then the item is replaced
with one created with the callback function specified by the
createFailedItemFunction
property.
The value of this property must be a function with two parameters: the index of the requested data provider item, and the ItemPendingError itself. In most cases, the second parameter can be ignored. The following example shows an implementation of the callback function:
function createPendingItem(index:int, ipe:ItemPendingError):Object { return "[" + index + "request is pending...]"; }
Setting this property does not affect provisional pending items that were already created. Setting this property to null prevents provisional pending items from being created.
Varsayılan değer şudur A function that unconditionally returns null..
Uygulama
public function get createPendingItemFunction():Function
public function set createPendingItemFunction(value:Function):void
İlgili API Öğeleri
length | özellik |
length:int
[salt okunur] Dil Sürümü: | ActionScript 3.0 |
Ürün Sürümü: | Flex 4 |
Çalışma Zamanı Sürümleri: | Flash Player 10, AIR 1.5 |
The number of items in this collection. 0 means no items while -1 means the length is unknown.
Bu özellik veri ciltleme kaynağı olarak kullanılabilir. Bu özellik değiştirildiğinde, collectionChange
olayını gönderir.
Uygulama
public function get length():int
list | özellik |
list:IList
Dil Sürümü: | ActionScript 3.0 |
Ürün Sürümü: | Flex 4 |
Çalışma Zamanı Sürümleri: | Flash Player 10, AIR 1.5 |
The IList object that this collection wraps. That means the object to which all of the IList methods are delegated.
If this property is null, the IList mutation methods, such as setItemAt()
,
are no-ops. The IList query methods, such getItemAt()
, return null
or zero (-1 for getItemIndex()
), as appropriate.
Varsayılan değer şudur null.
Bu özellik veri ciltleme kaynağı olarak kullanılabilir. Bu özellik değiştirildiğinde, listChanged
olayını gönderir.
Uygulama
public function get list():IList
public function set list(value:IList):void
AsyncListView | () | Yapıcı |
addItem | () | yöntem |
addItemAt | () | yöntem |
public function addItemAt(item:Object, index:int):void
Dil Sürümü: | ActionScript 3.0 |
Ürün Sürümü: | Flex 4 |
Çalışma Zamanı Sürümleri: | Flash Player 10, AIR 1.5 |
Adds the item at the specified index. The index of any item greater than the index of the added item is increased by one. If the the specified index is less than zero or greater than the length of the list, a RangeError is thrown.
Parametreler
item:Object — The item to place at the index.
| |
index:int — The index at which to place the item.
|
getItemAt | () | yöntem |
public function getItemAt(index:int, prefetch:int = 0):Object
Dil Sürümü: | ActionScript 3.0 |
Ürün Sürümü: | Flex 4 |
Çalışma Zamanı Sürümleri: | Flash Player 10, AIR 1.5 |
Returns the value of list.getItemAt(index)
.
This method catches ItemPendingErrors (IPEs) generated as a consequence of
calling getItemAt()
. If an IPE is thrown, an IResponder
is added to
the IPE and a provisional "pending" item, created with the
createPendingItemFunction
is returned. If the underlying request
eventually succeeds, the pending item is replaced with the real item. If it fails,
the pending item is replaced with a value produced by calling
createFailedItemFunction
.
Parametreler
index:int — The list index from which to retrieve the item.
| |
prefetch:int (default = 0 ) — An int indicating both the direction
and number of items to fetch during the request if the item is not local.
|
Object — The list item at the specified index.
|
Atar
RangeError — if index < 0 or index >= length .
|
İlgili API Öğeleri
getItemIndex | () | yöntem |
public function getItemIndex(item:Object):int
Dil Sürümü: | ActionScript 3.0 |
Ürün Sürümü: | Flex 4 |
Çalışma Zamanı Sürümleri: | Flash Player 10, AIR 1.5 |
Returns the index of the item if it is in the list such that getItemAt(index) == item.
Note: unlike IViewCursor.findxxx()
methods,
The getItemIndex()
method cannot take a parameter with
only a subset of the fields in the item being serched for;
this method always searches for an item that exactly matches
the input parameter.
Parametreler
item:Object — The item to find.
|
int — The index of the item, or -1 if the item is not in the list.
|
itemUpdated | () | yöntem |
public function itemUpdated(item:Object, property:Object = null, oldValue:Object = null, newValue:Object = null):void
Dil Sürümü: | ActionScript 3.0 |
Ürün Sürümü: | Flex 4 |
Çalışma Zamanı Sürümleri: | Flash Player 10, AIR 1.5 |
Notifies the view that an item has been updated.
This is useful if the contents of the view do not implement
IEventDispatcher
and dispatches a
PropertyChangeEvent
.
If a property is specified the view may be able to optimize its
notification mechanism.
Otherwise it may choose to simply refresh the whole view.
Parametreler
item:Object — The item within the view that was updated.
| |
property:Object (default = null ) — The name of the property that was updated.
| |
oldValue:Object (default = null ) — The old value of that property. (If property was null,
this can be the old value of the item.)
| |
newValue:Object (default = null ) — The new value of that property. (If property was null,
there's no need to specify this as the item is assumed to be
the new value.)
|
removeAll | () | yöntem |
public function removeAll():void
Dil Sürümü: | ActionScript 3.0 |
Ürün Sürümü: | Flex 4 |
Çalışma Zamanı Sürümleri: | Flash Player 10, AIR 1.5 |
Removes all items from the list.
If any item is not local and an asynchronous operation must be
performed, an ItemPendingError
will be thrown.
See the ItemPendingError documentation as well as
the collections documentation for more information
on using the ItemPendingError
.
removeItemAt | () | yöntem |
public function removeItemAt(index:int):Object
Dil Sürümü: | ActionScript 3.0 |
Ürün Sürümü: | Flex 4 |
Çalışma Zamanı Sürümleri: | Flash Player 10, AIR 1.5 |
Removes the actual or pending item at the specified index and returns it. All items whose index is greater than the specified index have their index reduced by 1.
If there is no actual or pending item at the specified index, for
example because a call to getItemAt(index)
hasn't caused the data to be
paged in, then the underlying list
may throw an ItemPendingError.
The implementation ignores the ItemPendingError and returns null.
Parametreler
index:int — The list index from which to retrieve the item.
|
Object — The item that was removed or null.
|
Atar
RangeError — if index < 0 or index >= length .
|
setItemAt | () | yöntem |
public function setItemAt(item:Object, index:int):Object
Dil Sürümü: | ActionScript 3.0 |
Ürün Sürümü: | Flex 4 |
Çalışma Zamanı Sürümleri: | Flash Player 10, AIR 1.5 |
Places the item at the specified index. If an item was already at that index the new item will replace it and it will be returned.
Parametreler
item:Object — The new item to be placed at the specified index.
| |
index:int — The index at which to place the item.
|
Object — The item that was replaced, or null if none.
|
toArray | () | yöntem |
public function toArray():Array
Dil Sürümü: | ActionScript 3.0 |
Ürün Sürümü: | Flex 4 |
Çalışma Zamanı Sürümleri: | Flash Player 10, AIR 1.5 |
Returns an array with the same elements as this AsyncListView. The array is initialized
by retrieving each item with getItemAt()
, so pending items are substituted where actual
values aren't available yet. The array will not be updated when the AsyncListView replaces
the pending items with actual (or failed) values.
Array — an array with the same elements as this AsyncListView.
|
toString | () | yöntem |
public function toString():String
Dil Sürümü: | ActionScript 3.0 |
Ürün Sürümü: | Flex 4 |
Çalışma Zamanı Sürümleri: | Flash Player 10, AIR 1.5 |
Returns a string that contains the list's length and the number of pending item requests. It does not trigger pending requests.
DöndürürString — A brief description of the list.
|
collectionChange | Olay |
mx.events.CollectionEvent
özellik CollectionEvent.type =
mx.events.CollectionEvent.COLLECTION_CHANGE
Dil Sürümü: | ActionScript 3.0 |
Ürün Sürümü: | Flex 3 |
Çalışma Zamanı Sürümleri: | Flash Player 9, AIR 1.1 |
Dispatched when the list's length has changed or when a list element is replaced.
The CollectionEvent.COLLECTION_CHANGE constant defines the value of thetype
property of the event object for an event that is
dispatched when a collection has changed.
The properties of the event object have the following values. Not all properties are meaningful for all kinds of events. See the detailed property descriptions for more information.
Property | Value |
---|---|
bubbles | false |
cancelable | false |
currentTarget | The Object that defines the
event listener that handles the event. For example, if you use
myButton.addEventListener() to register an event listener,
myButton is the value of the currentTarget . |
items | An Array of objects with
information about the items affected by the event.
The contents of this field depend on the event kind;
for details see the items property |
kind | The kind of event. The valid values are defined in the CollectionEventKind class as constants. |
location | Location within the target collection
of the item(s) specified in the items property. |
oldLocation | the previous location in the collection
of the item specified in the items property. |
target | The Object that dispatched the event;
it is not always the Object listening for the event.
Use the currentTarget property to always access the
Object listening for the event. |
type | CollectionEvent.COLLECTION_CHANGE |
Tue Jun 12 2018, 01:09 PM Z