The 'value' in your case is an object. Checkout for the 'value' in debug mode and extract the property from 'value' and then concatenate it. For example
(e.currentTarget as Text).text +="\n"+ value.empName; HTH, -Ravi On May 29, 3:30 pm, Karthik K <[email protected]> wrote: > hi ravi > > below is my class > > if i use the below class the data getting displayed but drag and drop not > hapenning > > public class DropTargetRenderer extends Canvas implements > IDropInListItemRenderer > { > private var _listData:DataGridListData; > private var textData:Text=new Text(); > > public function DropTargetRenderer() > { > super(); > > this.addEventListener(DragEvent.DRAG_ENTER,dragEnterHandler); > > this.addEventListener(DragEvent.DRAG_EXIT,dragExitHandler); > > this.addEventListener(DragEvent.DRAG_DROP,dragDropHandler); > } > public function get listData():BaseListData > { > return _listData; > } > public function set listData(value:BaseListData):void > { > _listData = DataGridListData(value); > } > override public function set data(value:Object):void > { > this.removeAllChildren() > super.data=value; > textData.text=String(data[_listData.dataField]); > > this.addChild(textData); > } > > public function dragEnterHandler(e:DragEvent):void{ > var dropTarget:Text = e.currentTarget as Text; > > if(e.dragSource.hasFormat('value')){ > DragManager.acceptDragDrop(dropTarget); > } > } > public function > dragExitHandler(e:DragEvent):void{ > var dropTarget:DataGridListData = e.currentTarget as > DataGridListData; > } > > public function > dragDropHandler(e:DragEvent):void{ > var value:String = > e.dragSource.dataForFormat('value') as String; > (e.currentTarget as Text).text +="\n"+ value > ; > } > } > > when i change the above class by extending text > > in the datagrid it is showing as [Object object] > > but drag and drop is happening > > public class DropTargetRenderer extends Text implements > IDropInListItemRenderer > { > private var _listData:DataGridListData; > private var textData:Text=new Text(); > > public function DropTargetRenderer() > { > super(); > > this.addEventListener(DragEvent.DRAG_ENTER,dragEnterHandler); > > this.addEventListener(DragEvent.DRAG_EXIT,dragExitHandler); > > this.addEventListener(DragEvent.DRAG_DROP,dragDropHandler); > } > override public function get listData():BaseListData > { > return _listData; > } > override public function set listData(value:BaseListData):void > { > _listData = DataGridListData(value); > } > override public function set data(value:Object):void > { > // this.removeAllChildren() > super.data=value; > textData.text=String(data[_listData.dataField]); > > this.addChild(textData); > } > > public function dragEnterHandler(e:DragEvent):void{ > var dropTarget:Text = e.currentTarget as Text; > > if(e.dragSource.hasFormat('value')){ > DragManager.acceptDragDrop(dropTarget); > } > } > public function > dragExitHandler(e:DragEvent):void{ > var dropTarget:DataGridListData = e.currentTarget as > DataGridListData; > } > > public function > dragDropHandler(e:DragEvent):void{ > var value:String = > e.dragSource.dataForFormat('value') as String; > (e.currentTarget as Text).text +="\n"+ value > ; > } > } > > Any help if you want i can send full code > > -- > Karthik.k > Mobile - +91-9894991640http://kkarthikresume.blogspot.com/ > > On Fri, May 29, 2009 at 3:41 PM, Ravi Mishra <[email protected]> wrote: > > > Hi Karthik, > > > Where did u put the following function > > > public function DropTargetRenderer() > > { > > super(); > > > this.addEventListener(DragEvent.DRAG_ENTER,dragEnterHandler); > > > this.addEventListener(DragEvent.DRAG_EXIT,dragExitHandler); > > > this.addEventListener(DragEvent.DRAG_DROP,dragDropHandler); > > } > > > make sure u call this function in the constructor of the class you are > > using it. > > > HTH, > > > -Ravi > > > On May 28, 4:14 pm, Karthik K <[email protected]> wrote: > > > hi Ravi > > > > i have one doubt > > > > i am already having one itemrenderer when i place the class data of > > > DropTargetRenderer inside my renderer it is having some problem > > > > below is the class i am using > > > > for all datagrid columns only one itemrenderer > > > > First i need to display data and after that drag and drop should work > > > > below will display data > > > > public class sampleItemRenderer extends Canvas implements > > > IDropInListItemRenderer > > > { > > > private var _listData:DataGridListData; > > > private var textData:Text=new Text(); > > > private var str : String =""; > > > private var arr : Array ; > > > private var canvas:Canvas=new Canvas(); > > > private var canvas1:Canvas=new Canvas(); > > > public function sampleItemRenderer() > > > { > > > super(); > > > } > > > public function get listData():BaseListData > > > { > > > return _listData; > > > } > > > public function set listData(value:BaseListData):void > > > { > > > _listData = DataGridListData(value); > > > } > > > override public function set data(value:Object):void > > > { > > > this.removeAllChildren() > > > super.data=value; > > > textData.text=String(data[_listData.dataField]); > > > textData.height=50; > > > textData.width=160 > > > arr = textData.text.split(","); > > > var box:VBox=new VBox(); > > > for(var i:int=0;i<arr.length;i++) > > > { > > > var text:Text = new Text(); > > > text.text = arr[i].toString(); > > > box.addChild(text); > > > this.addChild(box); > > > } > > > } > > > > } > > > > when i place your data drag and drop not happening > > > > public function DropTargetRenderer() > > > { > > > super(); > > > > this.addEventListener(DragEvent.DRAG_ENTER,dragEnterHandler); > > > > this.addEventListener(DragEvent.DRAG_EXIT,dragExitHandler); > > > > this.addEventListener(DragEvent.DRAG_DROP,dragDropHandler); > > > } > > > public function dragEnterHandler(e:DragEvent):void{ > > > var dropTarget:Text = e.currentTarget as Text; > > > > if(e.dragSource.hasFormat('value')){ > > > DragManager.acceptDragDrop(dropTarget); > > > } > > > } > > > public function > > > dragExitHandler(e:DragEvent):void{ > > > var dropTarget:DataGridListData = e.currentTarget > > as > > > DataGridListData; > > > } > > > > public function > > > dragDropHandler(e:DragEvent):void{ > > > var value:String = > > > e.dragSource.dataForFormat('value') as String; > > > (e.currentTarget as Text).text += value > > > ; > > > } > > > > it is not displaying > > > > any idea > > > > please help > > > > -- > > > Karthik.k > > > Mobile - +91-9894991640http://kkarthikresume.blogspot.com/ > > > > On Wed, May 27, 2009 at 6:45 PM, Karthik K <[email protected]> > > wrote: > > > > hi Ravi > > > > > I did that myself but sorry for not responding you > > > > > Thanks Ravi > > > > > -- > > > > Karthik.k > > > > Mobile - +91-9894991640 > > > >http://kkarthikresume.blogspot.com/ > > > > > On Wed, May 27, 2009 at 6:43 PM, Ravi Mishra <[email protected] > > >wrote: > > > > >> Yes u can do that also. At the time of drop, add "/n" into the string. > > > >> i. e. > > > > >> private function dragDropHandler(e:DragEvent):void{ > > > >> var value:String = e.dragSource.dataForFormat > > > >> ('value') as String; > > > > >> (e.currentTarget as Text).text + "/n" += > > > >> value; > > > >> } > > > > >> Try that out. I think it will help > > > > >> -Ravi > > > > >> On May 27, 3:48 pm, Karthik K <[email protected]> wrote: > > > >> > hi Ravi > > > > >> > Thanks a lot > > > > >> > Great Example > > > > >> > i have one doubt > > > > >> > can i place the dropped data next line i.e inside same cell because > > my > > > >> req > > > >> > is of that type > > > >> > i am creating calender application so that each event e.g between > > 8:00 > > > >> to > > > >> > 9:00 there will be three events one below the other > > > >> > so when i drag and drop if it is coming in next line will be very > > great > > > > >> > -- > > > >> > Karthik.k > > > >> > Mobile - +91-9894991640http://kkarthikresume.blogspot.com/ > > > > >> > On Wed, May 27, 2009 at 1:32 PM, Ravi Mishra < > > [email protected]> > > > >> wrote: > > > > >> > > 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> > > ... > > read more » --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

