Gotlifebar / gwtquery-plugins

Automatically exported from code.google.com/p/gwtquery-plugins
0 stars 0 forks source link

Removing the draggable element during the drop event causes the DragStopEvent to fail #34

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
If within a drop event handlers, we remove the draggable from the DOM, a 
NullPointerException occurs when we fire the DragStop event

java.lang.NullPointerException: null
    at gwtquery.plugins.draggable.client.events.DragContext.init(DragContext.java:104)
    at gwtquery.plugins.draggable.client.events.DragContext.<init>(DragContext.java:48)
    at gwtquery.plugins.draggable.client.events.AbstractDraggableEvent.<init>(AbstractDraggableEvent.java:41)
    at gwtquery.plugins.draggable.client.events.DragStopEvent.<init>(DragStopEvent.java:37)
    at gwtquery.plugins.draggable.client.Draggable$3.execute(Draggable.java:490)

Workaround :

Wrap your code removing the draggable from the dom inside and deferred command :

Scheduler.get().scheduleDeferred(new ScheduledCommand() {

      public void execute() {
          //remove your draggable element here

      }
});

Original issue reported on code.google.com by julien.d...@gmail.com on 3 Apr 2012 at 8:38