1. #1
    Sencha Premium Member
    Join Date
    May 2011
    Posts
    62
    Vote Rating
    1
    pscanlon1 is on a distinguished road

      0  

    Default Creating Drag and Drop from a tree view

    Creating Drag and Drop from a tree view


    Is it possible to drag a tree node onto a chart?

    I cant get the drop zone to work properly. I see that my treePanel is correctly dragging the node, but I cant get the drop to work. Am I missing something? Also I am using sencha architect and I do not see anything in the toolbox for drop zones.... My chart is in a panel, and on render, I run this function...
    Code:
    initializeDropZone: function() {
            /* var gridView = v,
            grid = gridView.up('gridpanel');*/
            debugger;
            this.dropZone = Ext.create('Ext.dd.DropZone', this.up('panel').getEl(), {
    
    
                //      If the mouse is over a target node, return that node. This is
                //      provided as the "target" parameter in all "onNodeXXXX" node event handling functions
                getTargetFromEvent: function(e) {
                    return e.getTarget('.hospital-target');
                },
    
    
                //      On entry into a target node, highlight that node.
                onNodeEnter : function(target, dd, e, data){
                    debugger;
                    Ext.fly(target).addCls('hospital-target-hover');
                },
    
    
                //      On exit from a target node, unhighlight that node.
                onNodeOut : function(target, dd, e, data){
                    Ext.fly(target).removeCls('hospital-target-hover');
                },
    
    
                //      While over a target node, return the default drop allowed class which
                //      places a "tick" icon into the drag proxy.
                onNodeOver : function(target, dd, e, data){
                    return Ext.dd.DropZone.prototype.dropAllowed;
                },
    
    
                //      On node drop, we can interrogate the target node to find the underlying
                //      application object that is the real target of the dragged data.
                //      In this case, it is a Record in the GridPanel's Store.
                //      We can use the data set up by the DragZone's getDragData method to read
                //      any data we decided to attach.
                onNodeDrop : function(target, dd, e, data){
                    debugger;
                    var rowBody = Ext.fly(target).findParent('.x-grid-rowbody-tr', null, false),
                        mainRow = rowBody.previousSibling,
                        h = gridView.getRecord(mainRow),
                        targetEl = Ext.get(target),
                        html = targetEl.dom.innerHTML;
    
    
                    if (html == 'Drop Patient Here') {
                        html = data.patientData.name
                    } else {
                        html = data.patientData.name + ', ' + targetEl.dom.innerHTML;
                    }
    
    
                    targetEl.update(html);
                    Ext.Msg.alert('Drop gesture', 'Dropped patient ' + data.patientData.name +
                    ' on hospital ' + h.data.name);
                    return true;
                }
            });
        }

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,754
    Vote Rating
    827
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Is the chart and tree part of the same ddgroup?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1

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