0 Replies Latest reply on Jul 14, 2011 4:02 AM by Scott R. Hamilton

    Referencing a source datagrid from within a drag and drop handler

    Scott R. Hamilton Level 1

      My application implements a drag and drop between two datagrids.


      I would like to keep track of how many times a particular row in the source datagrid has been dragged to the target.
      The drag and drop handler should increment a DataGridColumn in the source datagrid row each time this happens.


      I can't figure out a way to refer back to the source datagrid and set a value in its dataprovider from within the drag and drop handler function.


      The source datagrid is in a module and the target datagrid in in a popup called from the module. The function below is in the popped up custom component.


      //                    ______________
      public function dragDropHandler(event:DragEvent):void
         if (event.dragSource.hasFormat("items"))
            var sComponentName:String;
            var iPos:int;
            //From which component was the drag initiated? This works sComponentName is set
            sComponentName = String(event.dragInitiator);
            //This does not work, compile error
            iPos = event.dragInitiator.selectedIndex;
               trace("Comp:MealPlanDetailCreate, function:dragDropHandler - event.dragInitiator: " + event.dragInitiator + "    parent container: " + event.dragInitiator.parent)
              trace( "    sComponentName: " + sComponentName +" name pos: " + sComponentName.indexOf("dgMP"))