1. #1
    Sencha User
    Join Date
    Apr 2007
    Location
    Italy/UK
    Posts
    152
    Vote Rating
    0
    sj137 is on a distinguished road

      0  

    Default [2.0rc1][CLOSED] dragndrop multiple windows & ddgroups

    [2.0rc1][CLOSED] dragndrop multiple windows & ddgroups


    Hi i'm playing with the web desktop example and i created:

    2 identical grid windows with drag and drop enabled but with different ddgroups (eg ddgroup1 & ddgroup2)

    and

    2 identical (normal) windows with DropTargets but with different ddgroups (eg ddgroup1 & ddgroup2)

    ...the idea is you can drop rows from a grid into one of the 'normal' windows but not the other and viceversa

    however, if the 2 'normal' windows overlap, then when i hover the nodes over the wrong window, it shows the green-tick instead of the red-circle...

    in the attached image, the dragged rows are shown over the 'wrong' window, but because the 'right' window is behind it, it allows the drop....

    sorry if this is not a bug.... (it could be considered a feature ...but us quite confusing visually) i couldn't find any config options to change this.

    best regards

    SJ
    Attached Images
    Last edited by sj137; 9 Nov 2007 at 5:59 AM. Reason: to emphazise the main-problem amid the fluffy explaination

  2. #2
    Sencha User
    Join Date
    Apr 2007
    Location
    Italy/UK
    Posts
    152
    Vote Rating
    0
    sj137 is on a distinguished road

      0  

    Default


    this is my code, so you can re-create the situation easily :-)
    Attached Files

  3. #3
    Ext User
    Join Date
    Apr 2008
    Posts
    8
    Vote Rating
    0
    as is on a distinguished road

      0  

    Question Any solution for this problem?

    Any solution for this problem?


    Hello. I'm experiencing a similar situation in my project.

    Has anyone found a solution for this issue?

  4. #4
    Sencha User
    Join Date
    Apr 2012
    Location
    Austin, Texas
    Posts
    2
    Vote Rating
    0
    brian.moeskau is an unknown quantity at this point

      0  

    Default


    First off, this is not a bug in Ext. It's something you need to handle as part of your custom DD implementation. Your grids know nothing about the fact that they are in windows, or that z-order matters, so it's up to you to fix that. Here's the approach I would take...

    First, provide a custom notifyOver implementation so that you can restrict checking the ddGroup only of the window directly underneath the mouseover event. We're going to reuse the logic in each window, so write it as a simple ux:

    Code:
    Ext.ux.GridWindowDropTarget = Ext.extend(Ext.dd.DropTarget, {
        notifyOver : function(dd, e, data){
            var t = e.getTarget('.x-window');
            if(t){
                var win = Ext.getCmp(t.id);
                if(win && win.ddTarget){
                    return win.ddTarget.ddGroup == this.ddGroup ? this.dropAllowed : this.dropNotAllowed; 
                }
            }
            return this.dropNotAllowed;
        }
    });
    You may notice that the comparison checks win.ddTarget. This is not a standard Window property, and by default there is not an easy way to get to the window's underlying dropTarget implementation. An easy way to fix that is to simply add that as a dynamic property on the window instance. Instead of:

    Code:
    var mydd = new Ext.dd.DropTarget(win.getEl(), { ... }
    do this instead (also switching it to use our new ux):

    Code:
    win.ddTarget = new Ext.ux.GridWindowDropTarget(win.getEl(), { ... }
    Now on mouseover, notifyOver will fire and be able to compare the dragged item's ddGroup to that of the window it's over. I've attached the updated code.
    Attached Files

Thread Participants: 2