Don't use Array for a dataProvider that might be changed programmatically. The low level Array API methods like push() do not dispatch the necessary events to update the UI Wrap the array in and ArrayCollection, and use the collection API to update it.
Tracy Spratt, Lariat Services, development services available _____ From: [email protected] [mailto:[email protected]] On Behalf Of steveb805 Sent: Tuesday, December 08, 2009 1:46 PM To: [email protected] Subject: [SPAM] [flexcoders] Re: invalidateList not working on Menu control Yeah, My gut feeling was that calling the dataprovider assignment statement again was going to do the trick at the very least. I'll just use that since it definitely works - I guess I wanted to hear that particular option spoken from someone else. Thanks. --- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com, "tiborballai" <ballai.t...@...> wrote: > > Hi Steve, > > invalidateList() tells the component that it needs to refresh it's rows on the next update, but that doesn't mean that the component will reload it's data. > > You'll either have to use databinding, or update the templateMenu's dataprovider property once you make changes to arrayDP. > > with databiding: > You'll have to use the [Bindable] metadata tag when declaring arrayDP. > > [Bindable] > private var arrayDP:Array; > > and use BindingUtils to set the dataprovider: > BindingUtils.bindProperty(templateMenu, "dataprovider", this, "arrayDP"); > > > or, each time you change arrayDP, you can re-assign it as the templateMenu's dataprovider. > > Hope this helps, > > Tibor. > www.tiborballai.com > > --- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com, "steveb805" <quantumcheesedog@> wrote: > > > > Hi, actually I don't think that's supported for arrays, only arraycollections. It was my original code, but when running the app, you get a runtime error that refresh is not a function. Thanks though. > > > > --- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com, "invertedspear" <invertedspear@> wrote: > > > > > > I don't think I've done what you described before, but I think you should try refreshing the dataprovider. "arrayDP.refresh();" > > > > > > --- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com, "steveb805" <quantumcheesedog@> wrote: > > > > > > > > invalidateList is invalidating my mood ... no it's not that bad. > > > > > > > > I have a popUpButton: > > > > > > > > templateMenu = new Menu(); // global var > > > > templateMenu.labelField = "name"; > > > > templateMenu.dataProvider = arrayDP; > > > > templateMenu.selectedIndex = 0; > > > > templateMenu.showRoot = true; > > > > templatePopUpButton.popUp = templateMenu; > > > > > > > > > > > > Occassionally, I do an arrayDP.push(some object); > > > > > > > > I'd like the popUp's menu to immediately show this new item. > > > > > > > > I tried templateMenu.invalidateList(), but this is not working. > > > > > > > > The flash develop doc/hint says that invalidateList: "refresh all rows on the next update" > > > > > > > > How do you force the "next update". Is it invalidateDisplayList()? I tried that, adding it after invalidateList, but that didn't work. > > > > > > > > eager to be enlightened, > > > > Thanks, > > > > Steve > > > > > > > > > >

