Hybrid View

  1. #1
    Sencha Premium Member
    Join Date
    Jul 2007
    Posts
    96
    Vote Rating
    1
    Nam is on a distinguished road

      0  

    Question HELP!! onDragDrop getting triggered twice, and I cannot find a way to stop it!

    HELP!! onDragDrop getting triggered twice, and I cannot find a way to stop it!


    I have set up a onDragDrop event, which when triggered gets triggered twice, once by the item being dropped on, and once by the container for it, which is a dropzone. How can I stop the event from bubbling. I believe that's the term for what's occuring. I tried doing Event.stopPropagation(); but that didn't seem to do anything.
    Last edited by Nam; 20 Sep 2007 at 12:56 PM. Reason: Changing title to something more descriptive

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,645
    Vote Rating
    583
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Perhaps try returning false, or setting e.cancel to true.

  3. #3
    Sencha Premium Member
    Join Date
    Jul 2007
    Posts
    96
    Vote Rating
    1
    Nam is on a distinguished road

      0  

    Default


    nope, doesn't make any difference.

  4. #4
    Sencha Premium Member
    Join Date
    Jul 2007
    Posts
    96
    Vote Rating
    1
    Nam is on a distinguished road

      0  

    Default


    I have noticed that the order of the events assignments dictates when the event is triggered. If I set the ddtarget area, then set the drag element, when the ddtarget is initialized after the drag element, the ddtarget is the last event to bubble.
    But, if I initialize the drag element, then initialize the ddtarget area, the ddtarget is the last bubbling item.


    Here is a live example... http://www.foirc.net/

    Replication Instructions:
    1) Open example site, click on the + icon in the center panel toolbar to add a column.
    2) Drag one of the boxes into the new column.
    3) Drag another box into the new column.
    4) Drag the second box over the first box, and release drag.

    At this point, since the events bubble, the last event to bubble is the ddtarget which causes the box to always be appended to the column as the last element. If you attempt this with the initial two columns which are loaded by default, since they are initialized before the ddproxy, the last event triggered is the item being dropped on. Which is the functionality I want. Drag a box over another box, then the box is placed before the item being dropped on.

    In my understanding there is two ways to solve this problem. One, I could somehow disable the event from bubbling through to the ddtarget. Second, I could somehow change the weight of DD event triggers, so that I could have the events returned in a particular order. Problem is, I have no idea on how to do this with ExtJS.. Please, can someone give me an idea, hint, or something which can help me resolve this problem?

  5. #5
    Sencha Premium Member
    Join Date
    Jul 2007
    Posts
    96
    Vote Rating
    1
    Nam is on a distinguished road

      0  

    Default


    Hello? Does anyone have any idea about how to stop triggering two onDragDrop events? I've been trying everything,

    Ext.dd.DragDropMgr.stopPropagation = true;
    Event.stopPropagation();
    Event.stopEvent();
    Event.cancel = true;
    Ext.dd.DragDropMgr.stopEvent(Event);
    Ext.dd.DragDropMgr.lock();
    Ext.dd.DragDropMgr.unlock();


    Nothing is fricken working. I'm getting really fustrated with this, and I am not getting any responses. Please, someone with knowledge of DragDrop functionality take a look at this, and help a fellow developer out. PLEASE!! and Thank You!!

  6. #6
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,645
    Vote Rating
    583
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    When you say Event.method(), I assume you're referring to the event object that is being passed to the callback handler?

Thread Participants: 3