PDA

View Full Version : array of array collections


sbeausol
02-13-2009, 11:06 PM
I am managing a couple of array collections that i was hoping to hold in an array, however I'm having trouble getting the array collection back out of the array to populate into my data grid.

All the arraycollections have the same basic format with many rows like this:

arrayCol1.addItem({b: 500.27, bint: 23.55, Nnum: 1, aa: 'A'});

I'm setting my array of arrayCollections like this:

var array:array = new array();
array.push(arrayCol1);
array.push(arrayCol2);
array.push(arrayCol3);


getting the array collection back out to put into a datagrid however isn't working for me:

var ac:ArrayCollection = new ArrayCollection();
ac = array[2];
var column1:DataGridColumn = new DataGridColumn();
var column2:DataGridColumn = new DataGridColumn();
column1.dataField = ac.aa;
column2.dataField = ac.Nnum;



any thoughts?

wvxvw
02-13-2009, 11:21 PM
Caps in Array?
What's array.aa?

sbeausol
02-13-2009, 11:37 PM
sorry i edited my post...

basically i want to have an array which holds a bunch of array collections with index 1,2...n and i want to access my arraycollection by specifying the index of the array that is holding it, and eventually dump that into a datagrid...

make sense?

wvxvw
02-13-2009, 11:42 PM
OK...
var array:array = new array();
array.push(arrayCol1);
array.push(arrayCol2);
array.push(arrayCol3);
What's array here? is it some your custom class or misspelled Array?
What is ac.aa then? you never declare it anywhere, besides, ArrayCollection isn't dynamic class, thus this syntax should generate error.

sbeausol
02-13-2009, 11:46 PM
yeah sorry, i retyped some of my code instead of copying...

var array:array = new array();

should read

var array:Array = new Array();

ac is my arraycollection

var ac:ArrayCollection = new ArrayCollection();

and here is where i'm trying to set ac equal to on of the arraycollections (in this case arrayCol2) to ac, to eventually place into a data grid
ac = array[2];

wvxvw
02-13-2009, 11:52 PM
So far you should be OK then. What is not OK is this: column1.dataField = ac.aa;
ArrayCollection isn't dynamic class and it has no property "aa". While dataField is a string, that will be used as a pattern to filter the data of the dataprovider and decide what to display in the column.