Hybrid View

  1. #1
    Ext User
    Join Date
    Jun 2010
    Posts
    17
    Vote Rating
    0
    gr_great_2000 is on a distinguished road

      0  

    Default How to cancel a drop after an Ajax failure

    How to cancel a drop after an Ajax failure


    Hello everybody,

    I cannot cancel a drop event after an Ajax failure, e.g.

    function dropHandler(dropEvent) {
    ...
    dropEvent.cancel = false;
    Ext.Ajax.request {
    ...
    failure: {
    dropEvent.cancel = true;
    alert("On failure: "+dropEvent.cancel);
    }
    }
    alert("After request: "+dropEvent.cancel);
    }

    First the "After request: false" message is printed, then the "On failure: true" but it is late. How can I affectively cancel the drop on ajax failure? Any tips?

    Thanks in advance
    George

  2. #2
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    George,


    What UI widget are you using?

  3. #3
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    58
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Asynchronous!

  4. #4
    Ext User
    Join Date
    Jun 2010
    Posts
    17
    Vote Rating
    0
    gr_great_2000 is on a distinguished road

      0  

    Default


    I guess I am using asynchronous widgets. I use nodeType: 'async' in my trees, if this is what you are asking. I understand the fact that ajax request is asynchronous, but how can you handle such cases when you want to cancel a drop after an synchronous ajax request?

  5. #5
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    58
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    You can't! The drop happened aeons (In processor time) before the Ajax request creeps back along the wire!

  6. #6
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    I would say, return false from onNotifyDrop, cache the drop event, if the ajax event is successful, complete the drop. I've done this before and it works.

Similar Threads

  1. Cancel drop event in tree
    By MaxT in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 1 Nov 2011, 12:34 AM
  2. cancel drop event
    By fother in forum Ext GWT: Help & Discussion (1.x)
    Replies: 5
    Last Post: 3 Jun 2009, 5:55 AM
  3. How to cancel a drag drop of panel
    By red900 in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 10 Sep 2008, 11:56 AM
  4. How to cancel AJAX requests?
    By 72 in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 7 Nov 2007, 6:38 PM

Thread Participants: 2