Add a global ArrayCollection and set the the filter data to this AC.
Could you elaborate please?
Michael Borbor, Could you explain just a tad more what you mean by: "Add a global ArrayCollection and set the the filter data to this AC"?
If I knew how to get the filtered data, I would have solved the problem. My problem is that i do not know hpw to get the filtered data out of the original ArrayCollection. I only know ow to display the filtered data iby using it as _dataProvider on a component.
After you set the ArrayCollection's filterFunction, make sure you call refresh(). Then the contents of the ArrayCollection is the filtered/limited set.
To get the filtered elements into another ArrayCollection call its addAll() function passing the original, filtered one.
var original:ArrayCollection = new ArrayCollection();
original.filterFunction = theFilterFunction;
var limited:ArrayCollection = new ArrayCollection();
limited.addAll( original );
Let me know if that works like you wanted it to.
Also, you may find the following documentation and examples on ArrayCollection helpful:
Let me know if there's any information you'd like me to add.
addAll if not a method of the ArrayCollection class. Was that a typo?
Hmm, addAll() is a function for ArrayCollection with Flex SDK 3.3, but I guess not in some older versions. A loop could serve the same function...
for each( item in original )
filtered.addItem( item );
Let me know if it does the trick.
A few things:
- Thanks for your help, the final suggestion worked perfectly
- I am using Flex SDK 3.3, and addAll gave an error "undefined method." I am wondering why.
- What other goodies are part of the SDK 3.3
Thanks very much.