1. #1
    Ext User
    Join Date
    Oct 2009
    Posts
    3
    Vote Rating
    0
    bjornj is on a distinguished road

      0  

    Default TreePanel DND without removing node

    TreePanel DND without removing node


    Hi, just started to play with ext gwt, quite fun.

    I have a probably very simple question about dnd:
    I'm trying to make a drag'n'drop work from a TreePanel (to a TreeGrid).
    It works nice except that the nodes being dragged from the source
    are removed (which is normal in most cases). However I'd like them
    to stay since I use the tree as a 'palette' of actions.
    I'm assuming there is som simple setting to perform this, but am unable
    to find it. any tips?

    Thanks a lot // Bjorn

  2. #2
    Sencha User
    Join Date
    Oct 2009
    Location
    South Africa
    Posts
    82
    Vote Rating
    0
    g1_ is on a distinguished road

      0  

    Default


    Define the dropTarget like so:

    Code:
            DropTarget target = new DropTarget(xxx) {  
                @Override  
                protected void onDragDrop(DNDEvent event) {  
                    Info.display("MessageBox", "DND event occured");
                }  
            }; 
            target.setOperation(Operation.COPY) ;
    ie. the setOperation method should be used.
    note you'll have to import com.extjs.gxt.ui.client.dnd.DND.Operation ;

  3. #3
    Ext User
    Join Date
    Oct 2009
    Posts
    3
    Vote Rating
    0
    bjornj is on a distinguished road

      0  

    Default


    Works perfectly! Thanks for the answer, I didn't see
    this option before.

  4. #4
    Ext GWT Premium Member
    Join Date
    Mar 2009
    Posts
    226
    Vote Rating
    3
    The_Jackal is on a distinguished road

      0  

    Default


    You can also handle this at the source level if you want all targets not to remove items by overriding the TreePanelDragSource.onDragDrop

    Code:
    TreePanelDragSource source = new TreePanelDragSource(treePanel) {
        @Override
        protected void onDragDrop(DNDEvent event) {
            // Do nothing on drop - prevents removal of tree items
        }
    }

  5. #5
    Sencha User
    Join Date
    Feb 2011
    Posts
    1
    Vote Rating
    0
    vinaysu is on a distinguished road

      0  

    Default setOperation() for Droptarget is not working

    setOperation() for Droptarget is not working


    Hi All,

    I am new to GXT and in application i am using DragSource and DropTarget classes.

    by default Operation.MOVE is set while DragNDrop but i have set Operation.COPY in DropTarget but its not working as COPY still its removing the source from DragSource

    please find the code below:

    DragSource source = new DragSource(html) {
    @Override
    protected void onDragStart(DNDEvent event) {
    event.setData(html);
    event.getStatus().update(El.fly(html.getElement()).cloneNode(true));
    Info.display("DragSource", "Dragging kpis"+event.getOperation());
    }
    };
    source.setGroup("Library");


    ******

    DropTarget target = new DropTarget(center) {
    @Override
    protected void onDragDrop(DNDEvent event) {
    super.onDragDrop(event);
    Html html = event.getData();
    Info.display("DropTarget", "Dropping kpis"+event.getOperation());
    center.add(html);
    }
    };
    target.setOperation(Operation.COPY);
    target.setGroup("Library");
    target.setOverStyle("drag-ok");

    here "center" is ContentPanel

    please reply................
    Last edited by vinaysu; 22 Feb 2011 at 10:42 PM. Reason: spelling check

Thread Participants: 3

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi