RE: [flexcoders] Re: Dynamic Array Object Keys

2007-09-16 Thread Alex Harui
I didn't look at your code, but FWIW, I would create a virtual
ICollectionView.

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Jeremy Rottman
Sent: Sunday, September 16, 2007 8:21 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Dynamic Array Object Keys

 

What I mean by array objects, is basically making dynamic identifiers
in an associative array. However, I got this worked out.

The issue at hand is. I am creating dynamic datagrid columns. The data
for these columns are in two arrays. The first array holds the data
for hte column headers. And the second holds the data for the rows
with in the datagrid.

I am trying to defy how a normal datagrid works. Instead of having the
data for each column be in the same array index. I am trying to do it
where Column 1, has an array of items, and it only these rows in
Column 1 are affected by these items. Column 2 has, has an array of
items, and it only these rows in Column 2 are affected by these items.
And so on.

Here is a link to what my current build looks and acts like. I do have
view source on. Any help with figuring this out would be greatly
appreciated.
http://demo.elguapodev.com/test4.html
 

 



RE: [flexcoders] Re: Dynamic Array Object Keys

2007-09-16 Thread Alex Harui
Not sure what you mean by dynamic object keys, but look at
flash.utils.Dictionary.

 

I would dump out thisArr.  The DG looks fine, but the data is probably
messed up in its conversion from the results.

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Jeremy Rottman
Sent: Sunday, September 16, 2007 4:31 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Dynamic Array Object Keys

 

I got this part figured out, however I have run into another issue with
getting this fixed. Why I finally populate the datagrid with data, the
data comes out with all the data for column 1 in the first 4 rows, all
the data for column 2, in the next two rows, and all teh data for column
3 in the last 4 rows. 

This is an example of what it looks like



NAME 1

NAME 2

NAME 3

arrayData1

 

 

arrayData2

 

 

 

arrayData3

 

 

arrayData4

 

 

 

arrayData5

 

 

arrayData6


Here is the code that I am using to create this data.

private fu! nction createProvider():void{
columnArr = new Array();   
thisArr= new Array();   
dailyData = new Array();   
// iterate through result array and add new items to the arrays
for(var i:Number = 0; i < resultArr.length; i++){

// add new item to the array
columnArr.push({column:resultArr[i].colName,
dataField:"adcl" + i});

// set temp array to resultArr.child
dailyData! = resultArr[i].children; 
 &n! bsp;&nbs p; 
// iterate through child array
for(var n:Number = 0; n < dailyData.length; n++){
var dataObj:Object = new Object();
var identifier:String = "adcl" + i; 
dataObj[identifier] = dailyData[n].adcl;
//trace(dataObj[identifier]);
thisArr.push(dataObj);
}}



This is the function I am using to create my datagrid.

private function buildGrid():void { 
var dgc:DataGridColumn; 
var aColumnsNew:Array = dg.columns;  
for(var i:int = 0; i < columnArr.length; i++){ 
dgc = new DataGridColumn();
dgc.width = 30;
dgc.headerText = columnArr[i].column;
dgc.dataField = columnArr[i].dataField;
aColumnsNew.push(dgc);
   ! ; }
dg.columns = aCol! umnsNew; 
dg.dataProvider = thisArr;