Paket | mx.collections |
Gränssnitt | public interface ICollectionView extends IEventDispatcher |
Implementorer | ListCollectionView |
Språkversion: | ActionScript 3.0 |
Produktversion: | Flex 3 |
Körningsmiljöversioner: | Flash Player 9, AIR 1.1 |
ICollectionView
is a view onto a collection of data.
The view can be modified to show the data sorted according to various
criteria or reduced by filters without modifying the underlying data.
An IViewCursor provides to access items within a
collection. You can modify the collection by using the IViewCursor
interface insert()
and remove()
methods.
An ICollectionView
may be a view onto data that has been
retrieved from a remote location.
When Implementing this interface for data
that may be remote it is important to handle the case where data
may not yet be available, which is indicated by the
ItemPendingError
.
The IList
interface is an alternative to the
ICollectionView
interface.
Relaterade API-element
Egenskap | Definieras med | ||
---|---|---|---|
filterFunction : Function
A function that the view will use to eliminate items that do not
match the function's criteria. | ICollectionView | ||
length : int [skrivskyddad]
The number of items in this view. | ICollectionView | ||
sort : ISort
The ISort that will be applied to the ICollectionView. | ICollectionView |
Metod | Definieras med | ||
---|---|---|---|
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registrerar ett händelseavlyssnarobjekt för ett EventDispatcher-objekt så att avlyssnaren får meddelanden om händelser. | IEventDispatcher | ||
Returns whether the view contains the specified object. | ICollectionView | ||
Creates a new IViewCursor that works with this view. | ICollectionView | ||
Prevents changes to the collection itself and items within the
collection from being dispatched by the view. | ICollectionView | ||
Skickar en händelse till händelseflödet. | IEventDispatcher | ||
Enables auto-updating. | ICollectionView | ||
Kontrollerar om EventDispatcher-objektet har några avlyssnare registrerade för en viss typ av händelse. | IEventDispatcher | ||
itemUpdated(item:Object, property:Object = null, oldValue:Object = null, newValue:Object = null):void
Notifies the view that an item has been updated. | ICollectionView | ||
Applies the sort and filter to the view. | ICollectionView | ||
Tar bort en avlyssnare från EventDispatcher-objektet. | IEventDispatcher | ||
Kontrollerar om en händelseavlyssnare är registrerad för det här EventDispatcher-objektet eller något av dess överordnade objekt för den angivna händelsetypen. | IEventDispatcher |
Händelse | Sammanfattning | Definieras med | ||
---|---|---|---|---|
Dispatched when the ICollectionView has been updated in some way. | ICollectionView |
filterFunction | egenskap |
filterFunction:Function
Språkversion: | ActionScript 3.0 |
Produktversion: | Flex 3 |
Körningsmiljöversioner: | Flash Player 9, AIR 1.1 |
A function that the view will use to eliminate items that do not match the function's criteria. A filterFunction is expected to have the following signature:
f(item:Object):Booleanwhere the return value is
true
if the specified item
should remain in the view.
If a filter is unsupported, Flex throws an error when accessing
this property.
You must call refresh()
after setting the
filterFunction
property for the view to update.
Note: The Flex implementations of ICollectionView retrieve all items from a remote location before executing the filter function. If you use paging, apply the filter to the remote collection before you retrieve the data.
Implementering
public function get filterFunction():Function
public function set filterFunction(value:Function):void
Relaterade API-element
length | egenskap |
sort | egenskap |
sort:ISort
Språkversion: | ActionScript 3.0 |
Produktversion: | Flex 3 |
Körningsmiljöversioner: | Flash Player 9, AIR 1.1 |
The ISort that will be applied to the ICollectionView.
Setting the sort does not automatically refresh the view,
so you must call the refresh()
method
after setting this property.
If sort is unsupported an error will be thrown when accessing
this property.
Note: The Flex implementations of ICollectionView retrieve all items from a remote location before executing a sort. If you use paging with a sorted list, apply the sort to the remote collection before you retrieve the data.
Implementering
public function get sort():ISort
public function set sort(value:ISort):void
Relaterade API-element
contains | () | metod |
public function contains(item:Object):Boolean
Språkversion: | ActionScript 3.0 |
Produktversion: | Flex 3 |
Körningsmiljöversioner: | Flash Player 9, AIR 1.1 |
Returns whether the view contains the specified object.
Unlike the IViewCursor.findxxx
methods,
this search is succesful only if it finds an item that exactly
matches the parameter.
If the view has a filter applied to it this method may return
false
even if the underlying collection
does contain the item.
Parametrar
item:Object — The object to look for.
|
Boolean — true if the ICollectionView, after applying any filter,
contains the item; false otherwise.
|
createCursor | () | metod |
public function createCursor():IViewCursor
Språkversion: | ActionScript 3.0 |
Produktversion: | Flex 3 |
Körningsmiljöversioner: | Flash Player 9, AIR 1.1 |
Creates a new IViewCursor that works with this view.
ReturnerarIViewCursor — A new IViewCursor implementation.
|
disableAutoUpdate | () | metod |
public function disableAutoUpdate():void
Språkversion: | ActionScript 3.0 |
Produktversion: | Flex 3 |
Körningsmiljöversioner: | Flash Player 9, AIR 1.1 |
Prevents changes to the collection itself and items within the
collection from being dispatched by the view.
Also prevents the view from updating the positions of items
if the positions change in the collection.
The changes will be queued and dispatched appropriately
after enableAutoUpdate
is called.
If more events than updates to a single item occur,
the view may end up resetting.
The disableAutoUpdate
method acts cumulatively;
the same number of calls to enableAutoUpdate
are required for the view to dispatch events and refresh.
Note that disableAutoUpdate
only affects the
individual view; edits may be detected on an individual
basis by other views.
enableAutoUpdate | () | metod |
public function enableAutoUpdate():void
Språkversion: | ActionScript 3.0 |
Produktversion: | Flex 3 |
Körningsmiljöversioner: | Flash Player 9, AIR 1.1 |
Enables auto-updating.
See disableAutoUpdate
for more information.
Relaterade API-element
itemUpdated | () | metod |
public function itemUpdated(item:Object, property:Object = null, oldValue:Object = null, newValue:Object = null):void
Språkversion: | ActionScript 3.0 |
Produktversion: | Flex 3 |
Körningsmiljöversioner: | Flash Player 9, AIR 1.1 |
Notifies the view that an item has been updated.
This method is useful if the contents of the view do not implement
IPropertyChangeNotifier
.
If the call to this method includes a property
parameter,
the view may be able to optimize its notification mechanism.
Otherwise it may choose to simply refresh the whole view.
Parametrar
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.)
|
Relaterade API-element
refresh | () | metod |
public function refresh():Boolean
Språkversion: | ActionScript 3.0 |
Produktversion: | Flex 3 |
Körningsmiljöversioner: | Flash Player 9, AIR 1.1 |
Applies the sort and filter to the view.
The ICollectionView does not detect changes to a sort or
filter automatically, so you must call the refresh()
method to update the view after setting the sort
or filterFunction
property.
If your ICollectionView implementation also implements
the IMXMLObject interface, you should to call the
refresh()
method from your initialized()
method.
Returns true
if the refresh was successful
and false
if the sort is not yet complete
(e.g., items are still pending).
A client of the view should wait for a CollectionEvent event
with the CollectionEventKind.REFRESH
kind
property to ensure that the refresh()
operation is
complete.
Boolean — true if the refresh() was complete,
false if the refresh() is incomplete.
|
collectionChange | Händelse |
mx.events.CollectionEvent
egenskap CollectionEvent.type =
mx.events.CollectionEvent.COLLECTION_CHANGE
Språkversion: | ActionScript 3.0 |
Produktversion: | Flex 3 |
Körningsmiljöversioner: | Flash Player 9, AIR 1.1 |
Dispatched when the ICollectionView has been updated in some way.
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:40 PM Z