I tried to search for this but got a "server busy" error. I figured I would go ahead and post it. I appologize if this has been covered before.
I'm trying to dynamically generate columns for my datagrid. I don't have prior knowledge of the column attributes before receiving the data. I get two ArrayCollection objects, one with the data (gridData) and one with the metadata about the columns (called columnData from here on). Here is the function I am trying to write: public function updateGridData():void{ var column:DataGridColumn; var headers:String = new String(); for (var i:int =0; i<columnData.length; i++){ column = new DataGridColumn(columnData[i].name); //column.dataField = columnData.name; column.headerText = getheaderText(columnData[i]); //headers = headers + getheaderText(columnData[i]) + ", "; dGrid.columns.push(column); } dGrid.dataProvider = gridData; //mx.controls.Alert.show("Updated the DataGrid. Headers SHOULD be: " + headers); } The "getheaderText()" function returns the header text value based on a user selection (description or name). What am I doing wrong here? Thanks Dominic