PDA

View Full Version : [FIXED] TreeViewDragDrop plugin listeners configured incorrectly



azuroff
9 Feb 2012, 2:24 PM
I added the TreeViewDragDrop plugin to a tree view and created event listeners for the "drop" and "beforedrop" events.

The code gets written out with the listeners: {} as part of the plugin config, like this:


Ext.applyIf(me, {
viewConfig: {
plugins: [
Ext.create('Ext.tree.plugin.TreeViewDragDrop', {
dropGroup: 'treeDDGroup',
enableDrag: false,
listeners: {
beforedrop: {
fn: me.onTreedragdroppluginBeforeDrop,
scope: me
},
drop: {
fn: me.onTreedragdroppluginDrop,
scope: me
}
}
})
]
}
})


However, the listeners: {} should be part of the viewConfig object instead -


Ext.applyIf(me, {
viewConfig: {
plugins: [
Ext.create('Ext.tree.plugin.TreeViewDragDrop', {
dropGroup: 'treeDDGroup',
enableDrag: false,
})
],
listeners: {
beforedrop: {
fn: me.onTreedragdroppluginBeforeDrop,
scope: me
},
drop: {
fn: me.onTreedragdroppluginDrop,
scope: me
}
}
}
});


As deployed by Designer, the event handlers never fire. If I manually move the listeners: {} config to the correct place, they do fire.

aconran
9 Feb 2012, 2:29 PM
Thanks for the bug report.

You are correct, as documented in the Ext 4.x docs, the event is added/fired on the view itself instead of the plugin.
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.tree.plugin.TreeViewDragDrop-event-beforedrop

The question will be whether or not we continue to leave the events defined on the tree plugin and then hoist them up to the view on code generation OR if we dynamically add a drop/beforedrop event to the treeview when the plugin is added/removed and then let code generation work as usual.

azuroff
9 Feb 2012, 2:37 PM
Since the docs list those events as part of the plugin itself, it would be more intuitive to leave them defined on the plugin itself and hoist them up to the view at code generation time. I don't think people would necessarily expect to find the drop and beforedrop events in the list of view events.

aconran
2 Mar 2012, 3:34 PM
This will be fixed in the next build (> 298).