1 Reply Latest reply on Jul 24, 2007 4:14 AM by chris.huston.t10

    What's wrong with this code?

    Kira3005 Level 1
      Hello all, I would like to know why when I push the open button "Fichier is not added into my mx:DataGrid?

      Is someone know why and could explain to me?

      thank you
        • 1. What's wrong with this code?
          chris.huston.t10 Level 3
          You need to define variables as Bindable if you are going to bind them to controls. And you were adding the columns to the DataGrid instead of the selected values. Try the below code:

          public function Addfile():void
          {
          var Fichier:Object= tabArbre.selectedItem;
          resultData.addItem(Fichier);
          }

          [Bindable] public static var COMPUTER:File;


          [Bindable] public var resultData:ArrayCollection;

          If you want to add multiple selected rows to the DataGrid then you would set allowMultipleSelection="true" and use:

          public function Addfile():void
          {
          for each (var i:Object in tabArbre.selectedItems) {
          var Fichier:Object= i;
          resultData.addItem(Fichier);
          }
          }

          Vygo