All,

 

            I am trying to drag an item from a grid and drop it on a tree control.  I have found that the getDropParent seems to be the best bet when trying to find where to add a new child node to.  The only problem I am having is if the user chooses to drop the item on a branch that is currently closed, the getDropParent() call returns one level higher.  If the branch is set to open even with no children nodes then everything works.  I can kind of understand why it works like this, but is there a way to work around this.  Below is my dragDrop method, pretty much what everyone else has posted.  I could expand all branches when the drag begins but that could be ugly.

 

 

public function doDragDrop(event:Object)

            {                      

doDragExit( event);

                        var dragItems = event.dragSource.dataForFormat( "items" );

                        var targetForDrop = tree.getDropParent();

                        for ( var i = 0; i <dragItems.length; i++)

                        {

                                    targetForDrop.addTreeNode("test",dragItems[i]);

                                    tree.setIsOpen(targetForDrop, true);

                                    tree.selectItem(targetForDrop, true);

}

}

 

Thanks

 

 

 

Jeff

 



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to