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 function 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;

             // 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 = aColumnsNew;
         dg.dataProvider = thisArr;

Reply via email to