问题
I've created a tree using the treeviewdragdrop plugin like this:
Ext.create('Ext.tree.Panel', {
viewConfig: {
plugins: {
ptype: 'treeviewdragdrop'
},
listeners: {
drop: function (... do stuff
By default if you drag an item from one parent to another it moves it and you can ctrl-click to copy, but I just want to copy -- that is, I don't want it to stop displaying in the original node. I'm not doing anything in the drop to affect the store, so I'm not forcing a remove
回答1:
Oh, this was easy.
Add copy: true, like this:
Ext.create('Ext.tree.Panel', {
viewConfig: {
plugins: {
ptype: 'treeviewdragdrop'
},
copy: true,
listeners: {
drop: function (... do stuff
It does change the data that hits the drop listener, but that can be worked with.
来源:https://stackoverflow.com/questions/11125482/how-do-i-make-an-extjs-drag-and-drop-tree-be-copy-only-not-remove-items-from