PDA

View Full Version : Ext3->Ext4 Drag and Drop betweens two TreePanels with copy option



nik600
13 Feb 2012, 11:16 PM
Dear all

i'd like to "copy" node instead of "move" them, as in this example:

http://dev.sencha.com/deploy/ext-4.0.0/examples/tree/two-trees.html

but copying nodes instead of removing them from the original tree.

In ext-3 this was possible handling the
beforenodedrop event like this:



tree_to.on(
'beforenodedrop',
function (event){
/*
* create a new node
*/
return mynewnode;
}
);



in ext-4 the beforenodedrop is no longer available, i've tried many events:

beforeitemmove
beforeitemremove
beforeitemappend

but any of them are working.

Any help?

Thanks
(http://docs.sencha.com/ext-js/4-0/#%21/api/Ext.tree.Panel-event-beforeitemremove)

vietits
13 Feb 2012, 11:26 PM
Ext.tree.plugin.TreeViewDragDrop (http://docs.sencha.com/ext-js/4-0/#!/api/Ext.tree.plugin.TreeViewDragDrop) has two events: beforedrop and drop. Also, when you config the view with allowCopy: true and start the drag-drop by pressing Ctrl key, it will do the copying action instead of moving.

nik600
14 Feb 2012, 12:35 AM
Ok, great.

Do you know if is possible to force it to copy even if the CTRL button is not pressed?

Thanks

vietits
14 Feb 2012, 12:43 AM
Let try to config your view with copy: true.

nik600
14 Feb 2012, 1:04 AM
Great!

Thanks