var fieldNameArray:Array = ["COUNTY","SQMILES",year+"_PASTURE_ACRES",year+"_PASTURE_SQMILES_TREATED",year+"_ PCTAREA_PASTURE"]; var selectDGcolumns:Array = []; for each (var fieldName:String in fieldNameArray) { var dgColumn:DataGridColumn = new DataGridColumn; dgColumn.dataField = fieldName; trace (dgColumn.dataField); dgColumn.setStyle("textAlign","right"); selectDGcolumns.push(dgColumn); } dg.columns = selectDGcolumns; dg.dataProvider = results;
Solved! Go to Solution.
var dg:Fields_DataGrid = new Fields_DataGrid;
dg.dataProvider.removeAll();
dg.columns = [];
var fieldNameArray:Array = ["COUNTY","SQMILES",year+"_PASTURE_ACRES",year+"_PASTURE_SQMILES_TREATED",year+"_ PCTAREA_PASTURE"];
var selectDGcolumns:Array = [];
for each (var fieldName:String in fieldNameArray) {
var dgColumn:DataGridColumn = new DataGridColumn;
dgColumn.dataField = fieldName;
trace (dgColumn.dataField);
dgColumn.setStyle("textAlign","right");
selectDGcolumns.push(dgColumn);
}
dg.columns = selectDGcolumns;
dg.dataProvider = results;
var dg:Fields_DataGrid = new Fields_DataGrid;