views:

137

answers:

1

I have a Datagrid thats being populated by different Arrays... (headers/columns change for the same DataGrid)...

I would like to Select a Column of the Datagrid after it was generated by the Dataprovider and Bold it, and place it as the 'last column"

This is what I have.... and throwing an error:

private function populateGrid(evt:Object):void {
 dg.dataProvider = evt as Array;
 if (dg.columns.length > 0) {
      for (var i:int = 0; i < dg.columns.length; i++) {
           if (dg.columns[i].dataField == '_user_total') {
                DataGridColumn((dg.columns[i].dataField)).setStyle('fontWeight', 'bold');
           }
      }
 }

}

This way I would like to have One Datagrid (for different Arrays) )without having the Columns fixed and declared (like in MXML), but dynamic, and would like a 'specific' column to be Bolded, and placed as the last column, in this example, the column with dataField _user_total.

A: 
private function populateGrid(evt:Object):void {
 dg.dataProvider = evt as Array;
 if (dg.columns.length > 0) {
      for (var i:int = 0; i < dg.columns.length; i++) {
           if (dg.columns[i].dataField == '_user_total') {
                (dg.columns[i]).setStyle('fontWeight', 'bold');
           }
      }
 } 

}

So the code above does it for me

After finding the Column in question dynamically... we bold it!

Yozef