you can use an event handler for dragDrop event which adds the new
field to the dragged data.

may this example helps you:

Example: Copying data from a List control to a DataGrid control

You can use drag and drop to copy data between two different types of
controls, or between controls that use different data formats. To
handle this situation, you write an event handler for the dragDrop
event that converts the data from the format of the drag initiator to
the format required by the drop target.

In the following example, you can move or copy data from a List
control to a DataGrid control. The event handler for the dragDrop
event adds a new field to the dragged data that contains the date:

<?xml version="1.0"?>
<!-- dragdrop\DandDListToDG.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
    creationComplete="initApp();">

    <mx:Script>
        <![CDATA[
            import mx.events.DragEvent;
            import mx.managers.DragManager;
            import mx.core.DragSource;
            import mx.collections.IList;
            import mx.collections.ArrayCollection;

            private function initApp():void {
                srcList.dataProvider = new ArrayCollection([
                    {label:"First", data:"1"},
                    {label:"Second", data:"2"},
                    {label:"Third", data:"3"},
                    {label:"Fourth", data:"4"},
                ]);

                destDG.dataProvider = new ArrayCollection([]);
            }

            private function dragDropHandler(event:DragEvent):void {
              if (event.dragSource.hasFormat("items"))
              {
                // Explicitly handle the dragDrop event.
                event.preventDefault();

                // Since you are explicitly handling the dragDrop
event,
                // call hideDropFeedback(event) to have the drop
target
                // hide the drop indicator.
                // The drop indicator is created
                // automatically for the list controls by the built-
in
                // event handler for the dragOver event.
                event.currentTarget.hideDropFeedback(event);

                // Get drop target.
                var dropTarget:DataGrid =
                  DataGrid(event.currentTarget);

                var itemsArray:Array =
                    event.dragSource.dataForFormat('items') as Array;
                var tempItem:Object =
                    { label: itemsArray[0].label,
                      data: itemsArray[0].data,
                      date: new Date()
                    };

                // Get the drop location in the destination.
                var dropLoc:int = dropTarget.calculateDropIndex
(event);

                IList(dropTarget.dataProvider).addItemAt(tempItem,
dropLoc);
              }
            }
        ]]>
    </mx:Script>

    <mx:HBox>
        <mx:List  id="srcList"
            dragEnabled="true"
            dragMoveEnabled="true"/>

        <mx:DataGrid  id="destDG"
            dropEnabled="true"
            dragDrop="dragDropHandler(event);">
            <mx:columns>
                <mx:DataGridColumn dataField="label"/>
                <mx:DataGridColumn dataField="data"/>
                <mx:DataGridColumn dataField="date"/>
            </mx:columns>
        </mx:DataGrid>
    </mx:HBox>

    <mx:Button id="b1"
        label="Reset"
        click="initApp()"
    />

</mx:Application>

one more link is 
http://blog.flexexamples.com/2007/09/19/dragging-rows-between-two-different-flex-datagrid-controls/

On Apr 28, 5:15 pm, rjoshicool <[email protected]> wrote:
> Hi,
>
> I want to drag a row from my datagrid and drop it into an advanced
> datagrid. The columns in both the datagrids have different fields. How
> can this be done?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to