2 Replies Latest reply on Sep 13, 2009 6:02 PM by Marlene

    Access to data information in list component


      I have attached a screenshot of the information Ineed to "get at". I am still relatively new to Flex and I have a total disconnect about which code to use so I have tried all kinds of properties and functions. Now I am really confused. I want the user to be able to remove any of the restaurants and then email the list to themselves. The listComponent ID is favoritesList. The dataProvider comes from a drag-drop operation from a datagrid. The dataProvider for the datagrid was an arrayCollection with an id of restaruatnsAC.



        • 1. Re: Access to data information in list component
          joeroth2010 Level 1

          This trick is creating a second, empty, ArrayCollection which is databound to the drop-enabled list.  When you want to do anything to the items in that list, you simply work with that 2nd ArrayCollection.  Heres some code:


          <?xml version="1.0"?>


          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"   xmlns:ns1="*">






          import mx.collections.ArrayCollection;




          private var ac:ArrayCollection = new ArrayCollection([


          {restaurant: 'Restaurant 1'},


          {restaurant: 'Restaurant 2'},


          {restaurant: 'Restaurant 3'},


          {restaurant: 'Restaurant 4'}




          private var ac2:ArrayCollection = new ArrayCollection();


          private function removeSelected():void{




          <mx:DataGrid dataProvider="{ac}" dragEnabled="true">
                  <mx:DataGridColumn headerText="Restaurant" dataField="restaurant"/>


          <mx:DataGrid id="chosenList" dataProvider="{ac2}" dropEnabled="true">
                  <mx:DataGridColumn headerText="Restaurant" dataField="restaurant"/>


          <mx:Button label="Remove Selected" click="removeSelected()"/>







          Hope this helps.



          • 2. Re: Access to data information in list component
            Marlene Level 1

            Thank you. Your answer was very helpful!