5 Replies Latest reply on Mar 29, 2007 9:51 AM by Dr._Goomba

    Why won't my appended array bind to a datagrid?

    Dr._Goomba Level 1
      Why can't i get this puppy to bind to my data grid? I have tried doing this about 6 different ways and cant get it to bind. The only way i can get it to bind is to have them pre-defined which defeats the whole purpose. I need to build these on the fly.


      [Bindable]
      public var cars:Array;

      public function buildCars():void{
      var cars:Array = new Array();

      cars.push({make: "Honda", year: 1997, color: "maroon"});
      cars.push({make: "Chrysler", year: 2000, color: "beige"});
      cars.push({make: "Mercedes", year: 1985, color: "blue"});
      cars.push({make: "Fiat", year: 1983, color: "gray"});

      for (var i:int = 0; i < cars.length; i++){
      trace("a " + cars .color + " " + cars.year + " " + cars .make);
      }
      }


      <mx:DataGrid id="dg" dataProvider="{cars}"/>