Results 1 to 3 of 3

Thread: How To Cancel Drop Event

  1. #1
    Sencha User
    Join Date
    Jul 2013
    Posts
    23

    Default How To Cancel Drop Event

    Hello
    I would like to cancel drop event on tree. I have to show prompt before execute drop operation(move/insert) if user wants to move selected node. How I Can do it?
    Thanks

  2. #2
    Sencha User
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,737
    Answers
    109

    Default

    The DndDropEvent is not designed to be canceled, as it is notification that a drop is happening. Instead, you should monitor the progress of the drag and update the status to indicate that a potential drop at this time could be successful or could fail. This provides your user with constant feedback, instead of only discovering that a drop fails when they actually release the mouse.

    Two main ways you can achieve this - either subclass the DropTarget type you are using, or handle events from that drop target, and update the StatusProxy's via the setStatus method to mark that it may be dropped or not.

  3. #3
    Sencha User
    Join Date
    Jan 2015
    Posts
    29

    Default

    Quote Originally Posted by Colin Alworth View Post
    The DndDropEvent is not designed to be canceled, as it is notification that a drop is happening. Instead, you should monitor the progress of the drag and update the status to indicate that a potential drop at this time could be successful or could fail. This provides your user with constant feedback, instead of only discovering that a drop fails when they actually release the mouse.

    Two main ways you can achieve this - either subclass the DropTarget type you are using, or handle events from that drop target, and update the StatusProxy's via the setStatus method to mark that it may be dropped or not.
    what do you mean by handle events from that drop target? What event do I need to handle? I tried the following and it does not work.
    Code:
    	    target.addDragEnterHandler(new DndDragEnterHandler(){
    
    
    			@Override
    			public void onDragEnter(DndDragEnterEvent event) {
    				event.setCancelled(true);
    				event.getStatusProxy().setStatus(false);
    				System.out.println("drag enter! false");
    			}
    	    	
    	    });

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •