No Ben, sorry I didn't read the subject line all the way.  It works with
Flex 3.  I don't know the specific bug, but sometimes you can work
around the timing issues, by using callLater().

-TH

--- In [email protected], "bnjmnhggns" <bhigg...@...> wrote:
>
> Did you try it with Flex 2? Sorry if I didn't make that clear.
>
> --- In [email protected], "Tim Hoff" TimHoff@ wrote:
> >
> >
> > 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.filterFunction = function(item:Object):Boolean {
> > > return item.label > 0;
> > > }
> > > filtered_stuff.refresh();
> > > }
> > > ]]>
> > > </mx:Script>
> > > </mx:Application>
> > >
> >
>



Reply via email to