Looks like we can't reproduce the issue or there's a problem in the test case provided.
-
Sencha User
Canceling a drop event is not working
Required Information
Version(s) of Ext GWT
Ext GWT 3.0.0b
Browser versions and OS
(and desktop environment, if applicable)
Virtual Machine
«No»
Description
I wanted to do a custom validation when the dragged files enter a drop area. In order to do so, I've overridden onDragEnter in my custom GridDropTarget:
Code:
@Override
protected void onDragEnter(DndDragEnterEvent e) {
super.onDragEnter(e);
if (!valid) {
e.setCancelled(true);
e.getStatusProxy().setStatus(false);
}
}
However, this does not cause the drop to be cancelled (and the icon remains the green tick).
Run mode
Development mode
Expected result
The feedback indicator changes to a "not allowed" one and the drop is cancelled (meaning, the dragged elements are not added to the ListStore, etc.)
Actual result
The drop succeeds.
Test case
This custom drop target should reject all drops - but it doesn't.
Code:
public class RejectingGridDropTarget<M> extends GridDropTarget<M> {
public RejectingGridDropTarget(Grid<M> grid) {
super(grid);
}
@Override
public void onDragEnter(DndDragEnterEvent event) {
super.onDragEnter(event);
event.setCancelled(true);
event.getStatusProxy().setStatus(false);
}
}
Possible fix
The problem seems to lie in DropTarget::handleDragEnter - on line 365, when e.isCancelled (for example, in the custom onDragEnter, as it was in my case), the original event gets its status proxy updated - but the 'cancelled' status of the original event is not updated. The control goes back to DNDManager, where on line 125 the (original) event's cancelled field is checked and will go to the else branch, even though we've tried to cancel the event earlier.
-
Sencha User
Thanks for the report. I've filed a bug against the engineering team and will update here as soon as we have a fix.
-
Sencha User
I can confirm that this is not working. Can you guys give us a workaround?
-
-
Sencha User
I have the same problem with GXT 3.1 on February 25, 2015. Please fix it.
-
Sencha User
This bug is not fixed. Please make it open again.