[英]How do I make an ExtJS drag and drop tree be copy only — not remove items from the display?
I've created a tree using the treeviewdragdrop plugin like this: 我已经使用treeviewdragdrop插件创建了一棵树,如下所示:
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. 默认情况下,如果将一项从一个父项拖到另一个父项,它将移动它,并且可以按住ctrl键单击以进行复制,但是我只想复制-也就是说,我不希望它在原始节点中停止显示。 I'm not doing anything in the drop to affect the store, so I'm not forcing a remove
我并没有采取任何措施影响商店,所以我没有强迫撤除
Oh, this was easy. 哦,这很容易。
Add copy: true, like this: 添加副本:true,像这样:
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. 它确实会更改命中drop侦听器的数据,但是可以使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.