如何在TreePanel上拖放后触发事件

Mep*_*pps 4 extjs panel

我如何使用Ext.tree.ViewDDPlugin的事件?

我有一个使用DDPplugin的TreePanel,但我想知道如何监听drop事件.

这就是我的代码:

var monPretree = Ext.create('Ext.tree.Panel',{
            id : 'treepanel',
            title : 'TITRE',
            //width : 800,
            //height : 600,
            width : 500,
            enableDD: true,
            useArrows : true,
            viewConfig : {
                plugins : {
                    ptype: 'treeviewdragdrop',     
                      appendOnly: true,     
                      listeners: {       
                        drop: function (node, data, overModel, dropPosition) {         
                              alert('CHANGE');       
                        },       
                        notifyDrop: function (dragSource, event, data) {         
                              var nodeId = data.node.id;         
                              alert(nodeId);       
                        },       
                        notifyOver: function (dragSource, event, data) {         
                            alert('over');
                        }     
                    }   
                }

            },
            singleExpand : false,
            store : monPrestore,
            rootVisible : false,
Run Code Online (Sandbox Code Playgroud)

我想发送drop事件,例如,但我的代码不起作用

谢谢 :)

小智 10

我有同样的问题,找到了这个页面.

在文档中,在事件部分中有注释:"此事件是通过TreeView触发的.将侦听器添加到TreeView对象"

我试图在tree.Panel类中找到方法来获取视图,但未成功.所以,你需要做的只是将listners阻塞配置到viewConfig部分(不在插件部分):

viewConfig : {
                plugins : {
                    ptype: 'treeviewdragdrop',     
                    ...
                },
                listeners: {       
                        drop: function (node, data, overModel, dropPosition) {         
                              alert('CHANGE');       
                        },         
                    }   
                }

            },
Run Code Online (Sandbox Code Playgroud)

http://docs.sencha.com/ext-js/4-0/#!/api/Ext.tree.plugin.TreeViewDragDrop-event-drop