How do I make an ExtJS drag and drop tree be copy only — not remove items from the display?

自古美人都是妖i 提交于 2019-12-11 08:46:46

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!