Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    6
    Vote Rating
    0
    klimeryk is on a distinguished road

      0  

    Default Canceling a drop event is not working

    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)
    • «Firefox 11, Windows 7»

    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.

  2. #2
    Sencha User WesleyMoy's Avatar
    Join Date
    Oct 2009
    Location
    Redwood City, California
    Posts
    402
    Vote Rating
    2
    WesleyMoy is on a distinguished road

      0  

    Default


    Thanks for the report. I've filed a bug against the engineering team and will update here as soon as we have a fix.

  3. #3
    Sencha User
    Join Date
    Jul 2012
    Posts
    3
    Vote Rating
    0
    vadimmaximov is on a distinguished road

      0  

    Default


    I can confirm that this is not working. Can you guys give us a workaround?

  4. #4
    Sencha User calbertts's Avatar
    Join Date
    Oct 2014
    Location
    Cali - Colombia
    Posts
    1
    Vote Rating
    0
    calbertts is on a distinguished road

      0  

    Default


    I have the same problem with GXT 3.1