4 Replies Latest reply on Feb 16, 2010 12:54 PM by Yozef0

    Selecting and Setting Style to DataGridColumn after passing the DataProvider

    Yozef0 Level 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.