How about filtering the ArrayCollection?

 

Tracy Spratt 
Lariat Services 

Flex development bandwidth available 

________________________________

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Mike
Sent: Tuesday, January 27, 2009 4:32 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Best way to toggle elements in
ArrayCollections

 


Jason,

I'm doing something similar with checkboxes and the DataGrid.
Are you able to turn the visibility of your component on/off ?

Rather than modify the dataset, you may be able to use a checkbox event
to trigger the visibility change of your display component.

~Mike

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "Merrill, Jason" <jason.merr...@...>
wrote:
>
> So in my Flex 3 project I have an ArrayCollection, like this:
>
> [Bindable]
> private var myDataProvider:ArrayCollection = new ArrayCollection(
> [
> {country:"Apple", quantity:5},
> {country:"Pear", quantity:3},
> {country:"Banana", quantity:7},
> ]);
>
> This is the dataprovider for another visual component (this is not the
> actual data, I've simplified it for the sake of clarity in asking this
> question). I have some checkboxes that I want to use to toggle
elements
> in and out of the arrayCollection, thus changing what's shown in the
> visual component which is bound by databinding. I thought about just
> having a visual property in the dataprovider, but then found out I
> cannot access display list items in this third party chart component I
> am using, so the only way to change what is shown in the chart
component
> is to change what's contained in the array collection.
>
> My question is, while I can think of ways to do this (adding and
> removing elements in the ArrayCollection), but they all involve some
> pretty ugly Actionscript. Is there a good way to handle this, but
keep
> my data intact? How would you use checkboxes to toggle data in and
out
> of the ArrayCollection elegantly?
>
> Thanks,
>
> Jason Merrill
> Bank of America <<Picture (Device Independent Bitmap)>>
> Instructional Technology & Media * GCIB & Staff Support L&LD
>
> Interested in Flash Platform technologies? Join the Bank of America
> Flash Platform Developer Community
>
<blocked::http://sharepoint.bankofamerica.com/sites/tlc/flash/default.as
<http://sharepoint.bankofamerica.com/sites/tlc/flash/default.as> 
> px>
> Interested in innovative ideas in Learning? Check out the Innovative
> Learning Blog
> <http://sharepoint.bankofamerica.com/sites/ddc/rd/blog/default.aspx
<http://sharepoint.bankofamerica.com/sites/ddc/rd/blog/default.aspx> >
> and subscribe
>
<http://sharepoint.bankofamerica.com/sites/ddc/rd/blog/_layouts/SubNew.a
<http://sharepoint.bankofamerica.com/sites/ddc/rd/blog/_layouts/SubNew.a
> 
>
spx?List=%7B41BD3FC9%2DBB07%2D4763%2DB3AB%2DA6C7C99C5B8D%7D&Source=http%
>
3A%2F%2Fsharepoint%2Ebankofamerica%2Ecom%2Fsites%2Fddc%2Frd%2Fblog%2FLis
> ts%2FPosts%2FArchive%2Easpx> .
>

 

Reply via email to