View Full Version : Tree Drag&Drop: problem with drag handler

2 Apr 2012, 8:57 AM
Good day folks,
I've some problem with tree Drag&Drop.... in ExtJs4...

I've understand how handler DROP-ACTION:
In the viewConfig I use treeviewdragdrop plugin, and then I can handler DROP-ACTION with
beforedrop and drop listeners....

But How can I handler DRAG-ACTION?

In extJs3 I used this code

.... omissis ....

onNodeOver : function(target, dd, e, sourceNodeData){
if ( target is green ) accept drop-action
else stop drop-action

Now ( maybe ) Can I use Ext.dd.DragSource ??
But ... how??

Can you give me an advices... or a simple tutorial/example where I can see where I can tell to ExtJs4
" If target node is green accept drop else stop drop"

Thanks very much!

2 Apr 2012, 10:08 AM
onNodeDrop (http://docs.sencha.com/ext-js/4-0/#%21/api/Ext.dd.DropZone-method-onNodeDrop)

onNodeDrop: function(target, source, e, data) {
return IsGreen(target);


3 Apr 2012, 8:04 AM
Hi Ext_soft
In extjs4 I use Ext.tree.plugin.TreeViewDragDropView ( ptype: treeviewdragdrop )
for handler D&D, but TreeViewDragDropView has only 2 listeners:


Ext4 DOC (http://docs.sencha.com/ext-js/4-0/#!/api/Ext.tree.plugin.TreeViewDragDrop-event-beforedrop)

so.. I don't know how handler DRAG... : (

can you help me... or you know where can I find a tutorial or good example??

thanks anyway : D

6 Apr 2012, 5:59 AM
beforedrop: function(node, data, overModel, dropPosition, dropFunction, eOpts) {
return IsGreen(target);


11 Jun 2012, 10:26 AM
Handling beforedrop will stop the drop but does not prevent the view from showing the drag action as well as the green plus icon that indicates a valid drop point.

I think what Andrea is asking, is how to prevent the drag in the first place so that the user does not see the drag action if it shouldn't be allowed.

I'd like an answer to this as well.