View Full Version : TreeViewDragDrop: how to allow drop on all nodes, showing only "append" icon

7 Oct 2012, 1:16 AM

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:

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.


7 Oct 2012, 1:56 AM
In Ext.tree.ViewDropZone, the getPosition() returns false with appendOnly:true for leaves.
I fixed this by overriding this function and changing

noAppend = record.isLeaf(),

noAppend = false,