I haven't looked at Alex's example(which is probably a big mistake on my
part...), but here are some thoughts.  

 

You haven't said what the ArrayCollection is a collection *of*.  So it
is probably a collection of dynamic Objects.  

 

Normally this is not a problem, but in many cases, it is better to have
a strongly typed VO(value object), as this gives the access best
performance.

 

So, since you need another property, I suggest you create a vo class.
Make the whole class Bindable, unless you want to do different.  Include
all the fields in your normal object, plus add your special field to
that class.

 

Then, in your result handler, loop over your array of objects, and build
an ArrayCollection of your Vos.  One approach to this is to have a
"fill" method that takes the basic data object and populates the class
instance property values.

 

You wind up with the field you need, plus a best-case performance
situation.

 

If you want the shortcut, just loop over the items and add the new field
to the dynamic object.

 

Tracy

 

________________________________

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of jmfillman
Sent: Wednesday, January 07, 2009 7:34 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Modify arrayCollection Structure

 

I need to add an extra field where data will be added. The field 
would be empty, to start, and isn't coming from another 
arrayCollection to merge with the original.

JF
--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, Alex Harui <aha...@...> wrote:
>
> Merged array list example on my blog
> 
> From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>

[mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
] On Behalf Of jmfillman
> Sent: Wednesday, January 07, 2009 3:54 PM
> To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] Modify arrayCollection Structure
> 
> 
> Is there a good way to add a "column" of data to an arrayCollection?
> 
> For example, I have an arrayCollection with the following
> data "columns" as received from my remoteObject call:
> 
> id, firstName, lastName, phoneNumber
> 
> I need to add an extra "column" for use in my app:
> 
> id, firstName, lastName, phoneNumber, date
> 
> I don't need the last field saved in my database, but I haven't 
found
> a good way to add this extra "column" to the arrayCollection short 
of
> creating the extra field in the database and passing it back to my
> app with the query results. This seems unnecessary to have a "dummy"
> field in my database. I could probably loop through the results and
> add them to another arrayCollection with my needed structure, but
> from a performance standpoint in my app, that's a less desirable
> option than just using the "dummy" field.
> 
> Are there other options?
> 
> JF
>

 

Reply via email to