Dec 11, 2012, 9:34 PM
[CLOSED] Enable Drag & Drop dynamically in a treepanel
Hello:
How can I enable/disable the drag & drop in a tree dynamically?
Basically, I don't users to accidentally drag nodes because it's very easy to do it, and I want them to enable the drag & drop manually before being able to drag&drop.
I tried setting different properties on the TreeViewDragDrop and calling enable/disable on the plug-in but they don't have any effect. Also there seems to be no way to add or remove a plug-in dynamically, and by looking at the source code for the TreeViewDragDrop it wouldn't probably work.
In Ext.Net 1.x I used an extension of the TreePanel that allowed me enable it or disable it dynamically:
Thanks
How can I enable/disable the drag & drop in a tree dynamically?
Basically, I don't users to accidentally drag nodes because it's very easy to do it, and I want them to enable the drag & drop manually before being able to drag&drop.
I tried setting different properties on the TreeViewDragDrop and calling enable/disable on the plug-in but they don't have any effect. Also there seems to be no way to add or remove a plug-in dynamically, and by looking at the source code for the TreeViewDragDrop it wouldn't probably work.
In Ext.Net 1.x I used an extension of the TreePanel that allowed me enable it or disable it dynamically:
Ext.override(Ext.tree.TreePanel, {
allowDrag: function (allow) {
if (allow) {
if (this.enableDD || this.enableDrag) {
this.dragZone = new Ext.tree.TreeDragZone(this, this.dragConfig || { ddGroup: this.ddGroup || "TreeDD", scroll: this.ddScroll });
}
} else if (this.dragZone) {
this.dragZone.unreg(); // Unregister the dragZone so Dragging is disabled.
}
},
allowDrop: function (allow) {
if (allow) {
if (this.enableDD || this.enableDrop) {
this.dropZone = new Ext.tree.TreeDropZone(this, this.dropConfig || {
ddGroup: this.ddGroup || "TreeDD", appendOnly: this.ddAppendOnly === true
});
}
} else if (this.dropZone) {
this.dropZone.unreg(); // Unregister the dropZone so Dropping is disabled.
}
}
});
I think I will end up extending the TreeViewDragDrop plug-in to turn on or off dynamically the ability to drag & drop.Thanks
Last edited by Daniil; Dec 18, 2012 at 5:34 AM.
Reason: [CLOSED]