Yeah, simple splice or concat probably wont work for your case after
all.  You will need to build your AC manually as Scott and ivo suggest.

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Terry Allen
Sent: Wednesday, August 27, 2008 1:09 PM
To: [email protected]
Subject: Re: [flexcoders] How do I enter 2 arrays into one
arraycollection

 

Thank you both for your replies.

 

Tracy,  if I were to concat() the two arrays, how would I be able to
slip in the children field in the first array that represents the data
from the second array.

 

 

 

Basically, I am attempting to populate a advancedDatagrid using the
combination of two amfphp arrays. The data needs to be in Hierarchial
format such as this :

combinedArrayCollection(parentDataArray, childrenDataArray)

 

This would allow me to populate the datagrid with a groupable title and
do a inlinerender of another adg with the children data from
combinedArrayCollection.  

 

Maybe I am looking at this problem wrong since really all I need is to
append children:[arrayData] to the first array to get it to work. 

 

Do you have any advice on how I can accomplish this?

 

Thanks again for all of the help!

 

Terry

On Wed, Aug 27, 2008 at 1:10 PM, Tracy Spratt <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:

Also, you could splice() or concat() the source arrays, then wrap the
result in ArrayCollection.

Tracy

 

________________________________

From: [email protected] <mailto:[email protected]>
[mailto:[email protected] <mailto:[email protected]> ]
On Behalf Of Scott Melby
Sent: Wednesday, August 27, 2008 12:08 PM
To: [email protected] <mailto:[email protected]> 
Subject: Re: [flexcoders] How do I enter 2 arrays into one
arraycollection

 

Brute force approach (not sure if it'll compile, but it'll get you
close):

var combinedArray:Array = new Array();

for each(var obj:Object in array1)
{
combinedArray.push(obj);
}

for each(obj in array2)
{
combinedArray.push(obj);
}

myArrayCollection.source = combinedArray;

hth
Scott

-- 
Scott Melby
Founder, Fast Lane Software LLC
http://www.fastlanesw.com <http://www.fastlanesw.com/> 

tallen_eit wrote:
> Hello,
>
> I am trying to use 2 arrays I generate from a mySql database to 
> populate an AdvancedDataGrid. I need to be able to use the following 
> format but replace the static data with the two arrays I receive from 
> AMFPHP.
>
> (I pulled the following snippet from Peter Ent's blog (thank you
Peter!)
>
>
> [Bindable]
> private var companyData:ArrayCollection = new ArrayCollection(
> [ 
> {type:"department", title:"Engineering", children: new 
> ArrayCollection(
> [ 
> {type:"employee", name:"Erin M"},
> 
> {type:"employee", name:"Ann B"} ] ) },
> 
> ] );
>
>
> How could I place the following arrays in the statement above?
> Parent = myParentArray
> children = myChildrenArray
>
> Thank you,
>
> Terry Allen
>
>
>
>
> 

 

 

Reply via email to