0

I am trying to set up some event handlers within my controller to handle the beforedrop and drop events of the treeviewdragdrop plugin. The plugin belongs to the treeview, which is a child of the treepanel. I have tried numerous ways to reference the treeviewdragdrop plugin component, without any success. How can I access the compoenet from the controller?

I've tried the follwing among others:

'#treepanelID > treeviewdragdrop':{drop:this.afunction}

This doesn't work, what should I enter to reference the component and listen for the two afformentioend events.

Bbb
  • 271
  • 2
  • 8
  • 22

1 Answers1

2

You cannot access the plugin from the Controller, component selector. You can only access Ext.Components. A plugin is not an Ext.Component and usually fire events on the Ext.Component they add functionality to.

treeviewdragdrop is firing events on the treeview. Try this:

'#treepanelID treeview': {drop: function() {}}
Ruan Mendes
  • 90,375
  • 31
  • 153
  • 217
  • I beleive I can add a listener to the viewconfig of the treepanel and have an equivalent effect. Essentially the same solution. I, however, wanted to handle the event from the controller. I am considering setting up a listener in the view config which initiates an action similar to a button press which the controller in turn listens for. – Bbb Aug 16 '12 at 21:13
  • Was returning false in the listener config within the viewconfig. This didn't allow the other event handler to work.... – Bbb Aug 16 '12 at 21:19
  • @Bbb The answer is that you cannot, if the plugin is firing the event. I also did tell you how to make it work (make the plugin fire the event on the component itself). Let me show you how you could accomplish that... Show me the code you're using to instantiate the tree view and the plugin – Ruan Mendes Aug 16 '12 at 21:54
  • In this case you can access the events, without accessing the plugin. http://docs.sencha.com/ext-js/4-0/#!/api/Ext.tree.plugin.TreeViewDragDrop specifys the event is fired through the treeview – Bbb Aug 16 '12 at 22:09
  • '#treepanelID > treeview':{drop:this.afunction} – Bbb Aug 16 '12 at 22:09
  • ^^ that will work. However you are correct in saying you can't access the plugin through that sort of query. – Bbb Aug 16 '12 at 22:10
  • @Bbb There was never a question of whether you could access the plugin with component selectors in the controller... That's the first point of my answer – Ruan Mendes Aug 16 '12 at 22:14