5 Replies Latest reply on Dec 21, 2006 1:46 PM by eclesia

    help with dragging between datagrids

    eclesia
      I have a simple app that has two datagrids. I have enabled dragging between the grids (that works fine), however, when I load the swf into my main app and try the drag operation, the drag contents begin using a different point of origin and get 'stuck' to the cursor and won't release onto the second grid. So essentialy it works fine as a standalone swf, but when imported it fails.

      I know this must be rather basic, but what can I do to get the grids to understand that they are playing within a different coordinate system?
        • 1. Re: help with dragging between datagrids
          davidmedifit
          eclesia, can you post the code you are using?

          Thanks,

          David
          • 2. Re: help with dragging between datagrids
            eclesia Level 1
            Sure. There are three mxml files: test, subnav, steptwo.
            Test is the main application.
            Subnav is nested within test (loaded via swfloader) it is a sub navigation
            Steptwo is nested within subnav - it contains the final content (datagrids that I am trying to execute drag drop between.)

            CODE:
            test.mxml
            <?xml version="1.0" encoding="utf-8"?>
            <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
            <mx:TabNavigator top="50" left="20" right="10" bottom="10">
            <mx:Canvas label="Tab 1" width="100%" height="100%">
            <mx:SWFLoader x="0" y="0" source="subnav.swf" left="0" top="0" width="100%" height="100%"/>
            </mx:Canvas>
            </mx:TabNavigator>
            </mx:Application>


            subnav.mxml
            <?xml version="1.0" encoding="utf-8"?>
            <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
            <mx:TabNavigator top="50" left="20" right="10" bottom="10">
            <mx:Canvas label="Sub Nav" width="100%" height="100%">
            <mx:SWFLoader x="0" y="0" source="StepTwo.swf" left="0" top="0" width="100%" height="100%"/>
            </mx:Canvas>
            </mx:TabNavigator>
            </mx:Application>


            steptwo.mxml
            <?xml version="1.0"?>
            <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" horizontalAlign="left" verticalAlign="top" layout="absolute" backgroundGradientColors="[#ffffff, #ffffff]">
            <mx:Script>
            <![CDATA[
            import mx.collections.ArrayCollection;
            import mx.core.IFlexDisplayObject;

            [Bindable]
            public var myCollection:ArrayCollection = new ArrayCollection ([
            {Artist:'Carole King', Album:'Tapestry', Price:11.99},
            {Artist:'Paul Simon', Album:'Graceland', Price:10.99},
            {Artist:'Original Cast', Album:'Camelot', Price:12.99}
            ]);


            ]]>
            </mx:Script>
            <mx:Canvas top="10" left="10" bottom="10" right="10" id="myCanvas">
            <mx:HBox>
            <mx:Text text="Drag &amp; drop resources from the list, or add your own custom resources." />
            <mx:VBox>
            <mx:Label text="Available Resources"/>
            <mx:DataGrid id="srcgrid2" dataProvider="{myCollection}" allowMultipleSelection="true" dragEnabled="true" dropEnabled="true" dragMoveEnabled="false" >
            <mx:columns>
            <mx:DataGridColumn dataField="Artist"/>
            <mx:DataGridColumn dataField="Album"/>
            <mx:DataGridColumn dataField="Price"/>
            </mx:columns>
            </mx:DataGrid>
            </mx:VBox>

            <mx:VBox>
            <mx:Label text="My Resources"/>
            <mx:DataGrid id="destgrid2" allowMultipleSelection="true" dragEnabled="true" dropEnabled="true" dragMoveEnabled="true">
            <mx:columns>
            <mx:DataGridColumn dataField="Artist"/>
            <mx:DataGridColumn dataField="Album"/>
            <mx:DataGridColumn dataField="Price"/>
            </mx:columns>
            </mx:DataGrid>
            </mx:VBox>
            </mx:HBox>
            </mx:Canvas>

            </mx:Application>


            • 3. Re: help with dragging between datagrids
              eclesia Level 1
              Anybody got ideas about this?
              • 4. Re: help with dragging between datagrids
                Hugo_Core Level 1
                Hi eclesia,

                Tricky this one. I tested your code and work just fine , but running only the stepTwo application.

                Running the default test it does happen what you told, i think this is releted with your's "import" method.

                Can´t you have all in one app ?

                Waiting for more,
                Core []
                • 5. Re: help with dragging between datagrids
                  eclesia Level 1
                  Maybe I don't understand good Flex layout, but I followed this approach as I will have many tab stops with each displaying forms that contain 12 or more form objects. It seemed to me a good practice to break things out. Surely there must be a way to get the grids to drag correctly when accessed from a containing object. Perhaps one of the Adobe guru's will read this and comment!