PDA

View Full Version : DragDropEvent Question


ackerchez
05-03-2009, 07:29 AM
Hi All,

I have a scenario where I have to drag a node from one tree to another. Both trees are driven by XML and they display great. Once the drag is complete I need to isolate the data that was dragged and send it back to php so that I can update the database with the information that was added.

Here is my issue.

When I set the method to fire on the DragDropEvent, it almost seems like that event is firing before the actual drop happens. I can access the two trees when I debug, but the actual data driving the droptarget tree does not seem to be updated yet when the event fires and I am not able to reference the data that I dropped.

I also see that there is a property in the event called "draggedItem" but that is always coming up as null when the event fires.

Does anyone know of a solution to this?

Thanks!

JeTSpice
05-03-2009, 02:54 PM
you might try wrapping in a callLater. If your function were called writeToDataBase, then callLater(writeToDataBase).

However, this only delays the writeToDataBase function by one iteration of the displayManager. sometimes this is enough time, but not always.

I don't know of any "onDropComplete" function, but that would be the best. maybe it needs to be extended.

autokad
05-04-2009, 03:32 PM
dragComplete=""
I know they have it with panels and such

ackerchez
05-05-2009, 08:40 AM
thanks everyone, I worked it out.

It turns out that indeed the event does fire before the copy takes place but the data I was looking for is still stored. Here is how to access it.

var items:Array=event.dragSource.dataForFormat("treeItems") as Array;
xmlSource = XML(items[0]);