1. #1
    Ext Premium Member yyogev's Avatar
    Join Date
    Jun 2009
    Location
    Shoham, Israel
    Posts
    196
    Vote Rating
    6
    Answers
    5
    yyogev is on a distinguished road

      0  

    Question Unanswered: TreeViewDragDrop: how to allow drop on all nodes, showing only "append" icon

    Unanswered: TreeViewDragDrop: how to allow drop on all nodes, showing only "append" icon


    Hi,

    I have a tree view where I want to allow the user to move a node to a different parent node, taking with it all the tree below it.
    I want the following behavior when moving node X:
    • Allow drop of X on all nodes in the tree
    • Do not show 'before' and 'after' indicator - when hovering over a node only show the 'append' indicator
    • Don't allow drop of X on X
    • Don't allow drop of X on ancestor of X (or I could just ignore it on the drop event)
    • Don't allow drop of X on a descendant (node in sub-tree below X)
      • The node record has path field, which allow detection if T is below X or vice versa
    I tried the following config:
    Code:
            viewConfig:
            {
                plugins:
                {
                    ptype: "treeviewdragdrop",
                    containerScroll: true,
                    allowParentInsert: true,
                    allowContainerDrops: true,
                    appendOnly: true
                }
            }
    With appendOnly:true, The drop indicator is either green 'plus' or red 'no entry', which is how I want it, but it does not allow drop on leaves.
    With appendOnly:false, I also get drop indicator showing 'before' or 'after' when hovering over leaves, but I want to get the 'append' indicator (green 'plus').
    It looks like the view does not allow dropping X on any leaf. I don't see the point in this.

    I'd appreciate any suggestions on how to fix this behavior.

    Thanks,
    Yaron Yogev

    IT Software Developer

  2. #2
    Ext Premium Member yyogev's Avatar
    Join Date
    Jun 2009
    Location
    Shoham, Israel
    Posts
    196
    Vote Rating
    6
    Answers
    5
    yyogev is on a distinguished road

      0  

    Thumbs up Fixed with override on getPosition in Ext.tree.ViewDropZone

    Fixed with override on getPosition in Ext.tree.ViewDropZone


    In Ext.tree.ViewDropZone, the getPosition() returns false with appendOnly:true for leaves.
    I fixed this by overriding this function and changing
    Code:
    noAppend = record.isLeaf(),
    to
    Code:
    noAppend = false,
    Yaron Yogev

    IT Software Developer

Tags for this Thread