3 Replies Latest reply on Apr 14, 2010 11:04 AM by joan_lafferty

    Drag & Drop between mutiple tables


      I plan to drag two diffrent table data into one destinate table: any sample on it?




        • 1. Re: Drag & Drop between mutiple tables
          joan_lafferty Adobe Employee

          Can you elaborate on what you are looking for? Are you just looking for an example of having two List components with data and being able to drag between those two?  If so, the Flex List component has the properties dragEnabled and dropEnabled that you can set to true so that you can drag items between these two components.


          If your "table" is not a List component, then, please elaborate.  You can use Flex's DragManager.doDrag() method to pretty much initiate a drag of any Flex component.



          • 2. Re: Drag & Drop between mutiple tables
            master.card Level 1

            One of source DataGrid is following:


            <mx:DataGrid id="dataGrid1"  dataProvider="{arr}" dragEnabled="true"    dragMoveEnabled="true"   dropEnabled="true"
                            mouseMove="mouseMoveHandler(event);"  verticalScrollPolicy="on">


               private function mouseMoveHandler(event:MouseEvent):void { 
                         var dragInitiator:DataGrid=DataGrid(event.currentTarget); 
                         var ds:DragSource = new DragSource(); 
                          ds.addData(dataGrid1.selectedItem, "identity"); 
                         DragManager.doDrag(dragInitiator, ds, event); 


            The issue is it drags all DataGrid table, instead of one of rows, how do I fix the  function mouseMoveHandler




            • 3. Re: Drag & Drop between mutiple tables
              joan_lafferty Adobe Employee

              If you remove the mouseMoveHandler all together and just have:


              <mx:DataGrid id="dataGrid1"  dataProvider="{arr}"  dragEnabled="true"    dragMoveEnabled="true"   dropEnabled="true"


              then, you will be able to drag individual items from the DataGrid. This functionality is built into the DataGrid. If you want to do something special with the data item being dragged, override the dragStart event handler instead of mouseMove.