PDA

View Full Version : How me disallow Drag and Drop in treepanel



dmitry.akatev
14 Apr 2015, 11:20 PM
My English is bad :)

I have treepanel with plugin treeviewdragdrop:

//... code
viewConfig: {
plugins: {
ptype: 'treeviewdragdrop',
containerScroll: true
}
},
//... code


How me disallow Drag and Drop when I throw the node in this folder?
And allow Drag and Drop when I throw the node in another folder?

tristan.lee
16 Apr 2015, 11:31 AM
Hi,

You can disable the drop functionality on your plugin by setting the config option enableDrop


viewConfig: {
plugins: {
ptype: 'treeviewdragdrop',
containerScroll: true,
enableDrop: false
}
}

http://docs.sencha.com/extjs/4.2.3/#!/api/Ext.tree.plugin.TreeViewDragDrop-cfg-enableDrop

Hope this helps,
Tristan

daviddayag
26 Jul 2015, 11:51 PM
Hi,How can I disable this functionality in runtime?I want create a button that disabled this.I tried putting enableDrop = false, but after initialization this has no effect.Please help ASAP.Thanks.

tristan.lee
27 Jul 2015, 12:54 PM
I'm not sure if this can be achieved like you're hoping, at least not as straight-forward as you would like. This uses some private undocumented functionality and may affect other parts of the tree and DD functionality:

r6f

Psychokrameur
11 Dec 2015, 10:27 AM
Hello,

For a proper enable/disable method for this plugin :



Ext.define('DaikitManager.overrides.tree.plugin.TreeViewDragDrop', {
override: 'Ext.tree.plugin.TreeViewDragDrop',
enable: function() {
var me = this;
if (me.dragZone) {
me.dragZone.unlock();
}
if (me.dropZone) {
me.dropZone.unlock();
}
me.callParent();
},
disable: function() {
var me = this;
if (me.dragZone) {
me.dragZone.lock();
}
if (me.dropZone) {
me.dropZone.lock();
}
me.callParent();
}
});

This code come from Ext.grid.plugin.DragDrop, I think it should be integrated in Ext core.