It's possible that I misunderstand the question, but off of the top of
my head here are two ways to achieve what you are looking for:
1) On the server...
The easiest way to do this may be to set a page-size in your
destination to 200. (You may need LCDS 2.6 for this if this is a
nested collection.) The advantage of this is that ONLY 200 objects
will load rather than having to load all the objects and then have to
filter them on the client. You will need to make sure that the items
come in from LCDS sorted by the creation date so that you can get the
most recent 200.
1) On the client...
Create a <mx:ListCollectionView /> in your view and bind the incoming
ArrayCollection to the list property of the ListCollectionView. Add a
sort to this ListCollectionView which will sort the data by the most
recent to least recent. Finally create a filter function which
maintains a local counter to keep track of how many items have been
added to the list. The FilterFunction should return 'true' until the
counter hits 200 and then it should return false. You will need to
reset the counter on each refresh of the collection This all will look
something list this...
in MXML:
<mx:ListCollectionView id="id_myCollection" list="{myResult}"
sort="mySort" filterFunction="myCounterFilter"
collectionChange="resetCounter(event)"/>
<mx:DataGrid dataProvider="{id_myCollection}" />
in Actionscript:
private var myCounter:int
private function myCounterFilter(item:Object):Boolean{
//add logic here
myCounter++;
if(myCounter > 200){
return false
}
return true;
}
private function mySort():Sort{
//add sort logic here
}
private function resetCounter(event:CollectionChangeEvent):void{
if(event.type == CollectionChangeEvent.REFRESH){
this.myCounter = 0;
}
}
I haven't tested this, but that is the general idea.
Hopefully this can help achieve what you are looking for.
- Kevin
--- In [email protected], "richcianci" <[EMAIL PROTECTED]> wrote:
>
> I am aware that two arraycollections pointing to the same source
> contain references to the same set of objects. Let me clarify that I
> am speaking of an arraycollection that is managed by a custom
> assembler in LCDS 2.51. New items are being added to this
> arraycollection by a server-side process. The users want only to see
> the most recent 200 records.
>
> Now the source property of a managed arraycollection is null. The
> arraycollection.list.localItems property might possibly be used as you
> suggest, but I think any slice of this array would be static. As new
> items are added to the managed arraycollection, I would have to
> manually copy them to the collection actually bound to the grid and
> then manually remove the oldest items.
>