5 Replies Latest reply on Jun 23, 2006 8:32 PM by inlineblue

    Adding columns to a DataGrid

    cjwprostar.
      I'm having trouble adding columns to a DataGrid at runtime and can't figure out what to do.
      This is what I was trying to do:

      // There are 4 existing columns already and test() is run when a button is pushed
      public var c5:DataGridColumn;

      public function test():void{
      trace(projectDataGrid.columns); //gives [object DataGridColumn],[object DataGridColumn],[object DataGridColumn],[object DataGridColumn]
      trace(projectDataGrid.columnCount); //gives 4
      projectDataGrid.columns.push(c5); //tracing this gives 5
      trace(projectDataGrid.columns); //gives [object DataGridColumn],[object DataGridColumn],[object DataGridColumn],[object DataGridColumn]
      trace(projectDataGrid.columnCount); //gives 4
      // no change in columns
      }

      Any help would be welcomed.