1. #1
    Ext User
    Join Date
    Apr 2010
    Posts
    34
    Vote Rating
    0
    Kirua007 is on a distinguished road

      0  

    Question Double DragSource problem

    Double DragSource problem


    Hi,

    I have a problem with draggable elements :
    I have a panel draggable which contains a Html element draggable too.

    This 2 elements can be drag into a second panel with a drop target.

    When I drag the panel 1 into the panel 2 : OK
    But When I drag the html element into the panel 2, The dragSource of the panel 1 is executed (dragsource of html too) and The drop target received the panel 1, never the html element.

    I create a little example :
    Code:
    Window w = new Window();
            w.setSize(600,400);
            w.setResizable(false);
            w.setBodyBorder(false);
            w.setLayout(new FitLayout());
            
            LayoutContainer globalPanel = new LayoutContainer();
            globalPanel.setLayout(new ColumnLayout());
            
            final ContentPanel panel1 = new ContentPanel();
            panel1.setSize(290, 400);
            panel1.setBodyBorder(true);
            panel1.setHeaderVisible(true);
            panel1.setHeading("Panel1 draggable");
            DragSource source = new DragSource(panel1) {
                @Override
                protected void onDragStart(DNDEvent event) {
                    event.setData(panel1);
                    event.getStatus().update(El.fly(panel1.getElement()).cloneNode(true));
                }
            };
            final Html html = new Html("Html draggable");
            DragSource dragSource = new DragSource(html){  
                @Override  
                protected void onDragStart(DNDEvent event) {  
                    event.setData(html);
                    event.getStatus().update(El.fly(html.getElement()).cloneNode(true));  
                }  
            };
            panel1.add(html);
            
            ContentPanel panel2 = new ContentPanel();
            panel2.setBodyBorder(true);
            panel2.setSize(290, 400);
            panel2.setHeading("Panel2 Drop Zone");
            DropTarget target = new DropTarget(panel2) {
                @Override
                protected void onDragDrop(DNDEvent event) {
                    super.onDragDrop(event);
                    if(event.getData() instanceof Html)
                    {
                        Info.display("Drop!", "Html dropped");
                    }
                    else if(event.getData() instanceof ContentPanel)
                    {
                        Info.display("Drop!", "ContentPanel dropped");
                    }
                }
            };
            
            globalPanel.add(panel1);
            globalPanel.add(panel2);
            w.add(globalPanel);
            
            w.show();
    Anybody can help me please?

    Thank you for advance

  2. #2
    Sencha User
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    You need to cancel the drag interaction of the panel dragsource if you drag some html widget.

  3. #3
    Ext User
    Join Date
    Apr 2010
    Posts
    34
    Vote Rating
    0
    Kirua007 is on a distinguished road

      0  

    Default


    Thank you for your quickly answer.

    How can I cancel the drag interaction of the panel 1 ?

    Maybe, It's means that the drag source of Html know the dragsource of panel ?

  4. #4
    Sencha User
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Inside the dragstart, check the element. If it is an element that belong to the html widget, cancel it.

  5. #5
    Ext User
    Join Date
    Apr 2010
    Posts
    34
    Vote Rating
    0
    Kirua007 is on a distinguished road

      0  

    Default


    Inside the drag start of panel 1 , I don't know How can I get the element ( source and component var are equals to ContentPanel)

Similar Threads

  1. [CLOSED] Ext.dd.DragSource problem
    By BlueSkye in forum Ext 3.x: Help & Discussion
    Replies: 5
    Last Post: 27 Jul 2010, 1:24 PM
  2. Problem with SimpleComboBox and Double
    By ronbreizh in forum Ext GWT: Discussion
    Replies: 0
    Last Post: 18 Jan 2010, 5:34 AM
  3. problem about dragsource and droptarget
    By the_matrix22c in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 7 Jul 2009, 12:02 AM

Thread Participants: 1