Hybrid View

  1. #1
    Ext User
    Join Date
    Mar 2007
    Posts
    8
    Vote Rating
    0
    Chroder is on a distinguished road

      0  

    Default [2.0rc1/2.0.1] TreePanel: Dropping onto a Leaf Node

    [2.0rc1/2.0.1] TreePanel: Dropping onto a Leaf Node


    Whenever any node is set as a leaf, you can't append nodes to it via drag+drop.

    I think this must be a mistake since there are config options 'allowChildren' and 'allowDrop' to control such behavior.

    Changing this line of Ext.tree.TreeDropZone in getDropPoint() (removing the isLeaf check) fixes it:
    Code:
    var noAppend = tn.allowChildren === false || tn.isLeaf();

  2. #2
    Ext User rodiniz's Avatar
    Join Date
    Mar 2007
    Location
    Rio de Janeiro, Brazil
    Posts
    276
    Vote Rating
    0
    rodiniz is on a distinguished road

      0  

    Default


    I think this is a bug also... I was almost putting it as a feature request..hope to see it fixed soon.

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


    I don't think this is a bug. By declaring something as a leaf you're saying it can't have any children. If you want it to have a children, don't declare it as a leaf.

  4. #4
    Ext User rodiniz's Avatar
    Join Date
    Mar 2007
    Location
    Rio de Janeiro, Brazil
    Posts
    276
    Vote Rating
    0
    rodiniz is on a distinguished road

      0  

    Default


    But on a dynamic tree you can't transform any non leaf nodes into a leaf node.
    And that's not god..If a node doesn't have any children when its loaded that shouldn't mean it can't have any children always.

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


    Just because the node is at the lowest level of the tree, doesn't necessarily make it a leaf. A leaf node is only created if you specify it in the config for the node. If there's the possibility data might be added under it, then don't specify that property.

  6. #6
    Ext User rodiniz's Avatar
    Join Date
    Mar 2007
    Location
    Rio de Janeiro, Brazil
    Posts
    276
    Vote Rating
    0
    rodiniz is on a distinguished road

      0  

    Default


    If i remove all children from a node, dragging then to another node,it becomes a leaf and doesn't accept children any more...

  7. #7
    Ext User
    Join Date
    Aug 2007
    Posts
    23
    Vote Rating
    0
    Comma is on a distinguished road

      0  

    Default


    for Ext 1.1.1 find in ext-all.js:
    var H=J.allowChildren===false||J.isLeaf();
    and replase on:
    var H=J.allowChildren===false;

  8. #8
    Ext User
    Join Date
    Oct 2007
    Posts
    2
    Vote Rating
    0
    kylegohn is on a distinguished road

      0  

    Default great change, but how do you manage the icon?

    great change, but how do you manage the icon?


    If I add the following to my ext-all.js with the 1.1 version. My leaf does accept children however, the icon for the node remains a leaf and not a folder. Do you know how I would go about declaring the image of the said node to automatically have the folder icon?


    var H=J.allowChildren===false;

  9. #9
    Ext User
    Join Date
    Apr 2007
    Posts
    3
    Vote Rating
    0
    microboat is on a distinguished road

      0  

    Post


    我的办法是重载Ext.data.Node,添加一个setLeaf方法,然后在tree的append事件中把节点的leaf都设为false。
    PHP Code:
    Ext.override(Ext.data.Node, {
        
    setLeaf: function(value){
        
    this.leaf value;
    }
    }); 
    PHP Code:
    this.on('append',function(tree,p,n,index){
        
    n.setLeaf(false);
    }); 
    欢迎加入37921608群(QQ)一起研讨Ext。

  10. #10
    Sencha User
    Join Date
    May 2014
    Posts
    1
    Vote Rating
    0
    lanphuong23 is on a distinguished road

      0  

    Default


    good. thank you.