-
7 Mar 2009 1:03 AM #1
Cancel Drag on key event (Escape)
Cancel Drag on key event (Escape)
Hi all,
I'm trying to find a way to abort a drag-drop "mid-drag" when the user clicks escape.
So once the drag has commenced (and the item being dragged is displayed), I want to be able to cancel or abort this drag process when the user hits the escape key. So the subsequent drop event will not fire.
Anyone got a way to solve this?
Thanks.
-
8 Mar 2012 3:47 PM #2
I wanted this behavior in an app we are writing and did the following...
Code:Ext.getBody().on('keydown', function(e, t) { if (e.ESC === e.getKey()) { e.stopEvent(); var drag = Ext.dd.DDM.dragCurrent; drag.onInvalidDrop(t, e); Ext.dd.DDM.dragCurrent = null; } });Aaron Conran
@aconran
Sencha Architect Development Team
-
16 Oct 2012 7:11 AM #3
This used to work in Ext 4.0.7 but now in 4.1.2 it doesn't seem to be working anymore. Setting Ext.dd.DDM.dragCurrent to null kills everything. And not setting Ext.dd.DDM.dragCurrent to null doesn't stop the drop.
Did this happen to you, and how did you fix it?


Reply With Quote