hi karthik,

try this

<!--Main.mxml file-->
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="vertical">
<mx:ArrayCollection id="ac">
    <mx:Object ename="aaa" eno="111" sal="2000"/>
    <mx:Object ename="bbb" eno="222" sal="9000"/>
    <mx:Object ename="ccc" eno="333" sal="43000"/>
    <mx:Object ename="ddd" eno="444" sal="8000"/>
    <mx:Object ename="eee" eno="555" sal="5000"/>
</mx:ArrayCollection>

        <mx:TextInput id="ti" text="Text Comes Here"/>
        <mx:DataGrid id="dg" dataProvider="{ac}">
                <mx:columns>
                        <mx:DataGridColumn dataField="ename"
itemRenderer="com.CustomRenderer" editorDataField="text"/>
                        <mx:DataGridColumn dataField="eno"
itemRenderer="com.DropTargetRenderer" editorDataField="text"/>
                        <mx:DataGridColumn dataField="sal"
itemRenderer="com.DropTargetRenderer" editorDataField="text"/>
                </mx:columns>
        </mx:DataGrid>
</mx:Application>

//CustomRenderer file
package com
{
        import flash.events.MouseEvent;

        import mx.controls.Image;
        import mx.controls.Text;
        import mx.controls.dataGridClasses.DataGridListData;
        import mx.core.DragSource;
        import mx.managers.DragManager;

        public class CustomRenderer extends Text
        {
                public function CustomRenderer()
                {
                        super();
                        this.setStyle("fontWeight","bold");
                        this.setStyle("textAlign","left");
                        this.addEventListener(MouseEvent.MOUSE_MOVE,handleDrag);
                }

                override public function set data(value:Object):void{
                        super.data = value;
                        this.text = this.data[(listData as 
DataGridListData).dataField];
                        //this.addEventListener(MouseEvent.CLICK,clickHandler);
                }
                /* private function clickHandler(e:MouseEvent):void{

                }
                 */

                private function handleDrag(e:MouseEvent):void{
                        var obj:String = this.text;
                        var dragInitiator:Text = e.currentTarget as Text;
                        var dragSource:DragSource = new DragSource();
                        dragSource.addData(obj,'value');
                        var dragProxy:Image = new Image();
                        dragProxy.source = "admin2.gif";

                        
DragManager.doDrag(dragInitiator,dragSource,e,dragProxy);
                }
        }
}


//DropTargetRenderer.as file
package com
{
        import mx.controls.Text;
        import mx.events.DragEvent;
        import mx.managers.DragManager;

        public class DropTargetRenderer extends Text
        {
                public function DropTargetRenderer()
                {
                        super();
                        
this.addEventListener(DragEvent.DRAG_ENTER,dragEnterHandler);
                        
this.addEventListener(DragEvent.DRAG_EXIT,dragExitHandler);
                        
this.addEventListener(DragEvent.DRAG_DROP,dragDropHandler);
                }


                private function dragEnterHandler(e:DragEvent):void{
                        var dropTarget:Text = e.currentTarget as Text;

                        if(e.dragSource.hasFormat('value')){
                                DragManager.acceptDragDrop(dropTarget);
                        }
                }

                private function dragExitHandler(e:DragEvent):void{
                        var dropTarget:Text = e.currentTarget as Text;
                }

                private function dragDropHandler(e:DragEvent):void{
                        var value:String = e.dragSource.dataForFormat('value') 
as String;

                        (e.currentTarget as Text).text += value;
                }
        }
}


Put all the above mentioned files in the relevant packages and run.
Try to drag a value from first column and drop it to either 2nd or 3rd
column.

HTH,

-Ravi


On May 27, 11:44 am, Karthik K <[email protected]> wrote:
> hi Ravi
>
> when i drag to the cell(where one data already exist) it is not standing in
> the exact cell
> it is moving to cell above or below
>
> if there is any example
> please help me
>
> very critical
>
> --
> Karthik.k
> Mobile - +91-9894991640http://kkarthikresume.blogspot.com/
>
> On Wed, May 27, 2009 at 12:09 PM, Ravi Mishra <[email protected]>wrote:
>
>
>
> > Yes u can! Just concatenate the dropped data to the previously dropped
> > data.
>
> > -Ravi
>
> > On May 27, 11:34 am, Karthik K <[email protected]> wrote:
> > > hi guys
>
> > > i have one doubt
>
> > > can i drag and drop data in same cell twice means
> > > i am dragging data to one cell
> > > i am dragging data to the same cell again so that two data in one cell
>
> > > please help
>
> > > --
> > > Karthik.k
> > > Mobile - +91-9894991640http://kkarthikresume.blogspot.com/
>
>
--~--~---------~--~----~------------~-------~--~----~
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