1 Reply Latest reply on May 7, 2009 5:46 AM by _Natasha_

    Problem with drag and drop in advanced datagrid

    rjoshicool Level 2

      I am dragging an item from a datagrid and dropping it in an advanced datagrid. The ADG is having a tree like structure. I am handling the dragDrop event of the ADG to do so. How can I get to know the parent of the node where I drop the item from datagrid?

        • 1. Re: Problem with drag and drop in advanced datagrid
          _Natasha_ Level 4

          Hi,

           

          as an example:

          // newView - destination datagrid

          // I use XML as a dataSource

          private function onDragDrop(event:DragEvent):void

          {

          var drgData:Array = event.dragSource.dataForFormat(event.dragSource.formats[0]) as Array;

          var drgNode:XML = drgData[0];

          var i:int = newView.calculateDropIndex(event);

          event.stopImmediatePropagation();

          // replace data to destination

          // item at that point you have droped data

          var postNode:XML = newView.indexToItemRenderer(i).data as XML;

          // parent of this item

          var newParent:XML = newView.getParentItem(postNode);

          // here you can do what you want

          }