Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha User
    Join Date
    Jul 2010
    Posts
    6
    Vote Rating
    4
    london_lawyer is on a distinguished road

      0  

    Default Tree drag-and-drop & node allowDrop: Ext.tree.ViewDropZone getPosition()

    Tree drag-and-drop & node allowDrop: Ext.tree.ViewDropZone getPosition()


    In ExtJS 3, I was able to designate a leaf as being capable of receiving drag-and-drop appending by setting allowDrop = true.

    This worked through the node's allowChildren property, which could be set independently or via allowDrop. The allowChildren property was checked in the relevant places in Ext.tree.TreeDropZone.

    In ExtJS 4.1.1, I don't see a way to allow appending to leaves. Have I missed something? Apologies if I have. If not, surely the inability to effectively manipulate which nodes are leaves and which are branches is a bug, particularly when it was so easy in ExtJS 3.

    I think this can be easily fixed via the following (or similar) changes to Ext.tree.ViewDropZone. I've marked changed rows with a "change" comment.

    PHP Code:
    getPosition: function(enode) {
            var 
    view this.view,
            
    record view.getRecord(node),
            
    e.getPageY(),
            
    append record.get('allowDrop'), // change
            
    noBelow false,
            
    region Ext.fly(node).getRegion(),
            
    fragment;


        
    // If we are dragging on top of the root node of the tree, we always want to append.
        
    if (record.isRoot()) {
            return 
    'append';
        }


        
    // Return 'append' if the node we are dragging on top of is not a leaf else return false.
        
    if (this.appendOnly) {
            return 
    append 'append' false// change
        
    }


        if (!
    this.allowParentInsert) {
            
    noBelow record.hasChildNodes() && record.isExpanded();
        }


        
    fragment = (region.bottom region.top) / (append 2); // change
        
    if (>= region.top && < (region.top fragment)) {
            return 
    'before';
        }
        else if (!
    noBelow && (append !== true || (>= (region.bottom fragment) && <= region.bottom))) { // change
            
    return 'after';
        }
        else {
            return 
    'append';
        }

    If record.get('allowDrop') always returns true or false, I guess you could keep the variable noAppend, set it equal to !record.get('allowDrop'), and ignore the other changes.

    Right now (in ExtJS 4.1.1), noAppend is equal to record.isLeaf(). Designating a node as a leaf is, to my mind, indicating that there are no current children, not indicating that there never could be. The developer needs to be able to control separately whether there *may* be children, and the allowDrop config is the natural way to do so.

  2. #2
    Sencha User
    Join Date
    Jul 2010
    Posts
    6
    Vote Rating
    4
    london_lawyer is on a distinguished road

      0  

    Default


    After fiddling around with an override, I realized it's not quite so simple after all. So I imagine the better way to do it is just to designate anything that *might* be a branch as not-a-leaf, with an empty array for children (if preloading the whole tree).

    So ignore this, I guess! Sorry.

  3. #3
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,797
    Vote Rating
    602
    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


    You're correct, if you set a node to be a leaf it can never have children, so you're better off just having an "empty" node.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

Thread Participants: 1

Tags for this Thread

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