PDA

View Full Version : How are plugins registered with PluginManager



billsalvucci
4 Oct 2012, 5:59 AM
I am struggling with PluginManager. I added rowediting plugin to a grid panel


plugins: [
Ext.PluginManager.create({
ptype: 'rowediting',
pluginId: 'activitiesRowEditingPlugin',
clicksToEdit: 1
})
]


and am trying to use it in a Controller action



onMenuItemClick: function(item) {
console.log(Ext.PluginManager.getCount());
var rowEditor = Ext.PluginManager.get('activitiesRowEditingPlugin');
rowEditor.cancelEdit();
console.log("clicked " + item.text);
}


The count of the PluginManager is 0 and, of course, the get returns nothing.

I'm using extjs 4.1

Can anyone explain how/when plugins get registered with PluginManager and if there are any secret tricks for accessing them from the PluginManager?
If they are not registered by extjs framework, where should I put the code to explicitly register them myself?

skirtle
4 Oct 2012, 6:44 AM
Plugin instances aren't registered with the PluginManager. PluginManager is a registry of plugin classes, not plugin instances. It differs from ComponentManager and StoreManager in that regard.

To get a particular plugin by id you need to use getPlugin on the owner component:

http://docs.sencha.com/ext-js/4-1/#!/api/Ext.AbstractComponent-method-getPlugin