No, I'm using Flex 3; maybe time to upgade Ben.

-TH

--- In [email protected], Alex Harui <aha...@...> wrote:
>
> Tim, did you try that in Flex 2?  I seem to recall it being a bug.
> 
> Alex Harui
> Flex SDK Developer
> Adobe Systems Inc.<http://www.adobe.com/>
> Blog: http://blogs.adobe.com/aharui
> 
> From: [email protected] [mailto:[email protected]] On 
> Behalf Of Tim Hoff
> Sent: Monday, April 06, 2009 12:17 PM
> To: [email protected]
> Subject: [flexcoders] Re: ListCollectionView w/ a filterFunction as a 
> dataProvider - Flex 2
> 
> 
> Hmm, ran your code and it worked fine.  Clicked the add item button the first 
> time and "1" showerd up.  Maybe try adding filtered_stuff.refresh(); to the 
> addItem function.
> 
> -TH
> 
> --- In [email protected], "bnjmnhggns" <bhiggins@> wrote:
> >
> > Hi all, I've been having weird problems involving Lists, dataProviders, 
> > ListCollectionViews with and ArrayCollections. I was able to reproduce one 
> > of my problems below.
> >
> > I have a ListCollectionView (filtered_stuff) that's viewing an 
> > ArrayCollection (stuff). stuff initially just has one element. 
> > filtered_stuff has a filterFunction that filters out this element.
> >
> > Here's the weird part. Clicking on Add item once does not show the added 
> > item in the List. Clicking on Add item again will result in TWO items 
> > showing up in the list. After that, clicking Add item behaves as you might 
> > expect.
> >
> > Why is it behaving this way?
> >
> > Thanks,
> >
> > Ben
> >
> > Code:
> >
> > <?xml version="1.0"?>
> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";>
> ! > <mx:Panel title="List dataProvider test" creationComplete="onCreate()"
> > paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10">
> >
> > <mx:List id="list" width="100%" dataProvider="{filtered_stuff}"/>
> > <mx:Button click="addItem()" label="Add item"/>
> > </mx:Panel>
> >
> > <mx:Script>
> > <![CDATA[
> > import mx.collections.ListCollectionView;
> > import mx.collections.ArrayCollection;
> >
> > [Bindable] public var stuff:ArrayCollection;
> > [Bindable] public var filtered_stuff:ListCollectionView;
> >
> > public function addItem():void {
> > trace("adding item", stuff.length);
> > stuff.addItem({label: stuff.length});
> > }
> >
> > public function onCreate():void {
> > stuff = new ArrayCollection([{label: 0}]);
> > filtered_stuff! = new ListCollectionView(stuff);
> > filtered_stuff.! fil terFunction = function(item:Object):Boolean {
> > return item.label > 0;
> > }
> > filtered_stuff.refresh();
> > }
> > ]]>
> > </mx:Script>
> > </mx:Application>
> >
>


Reply via email to