-
29 Apr 2011 12:22 AM #1
[CLOSED][4.0.0] Ext.AbstractComponent.getPlugin() issue?
[CLOSED][4.0.0] Ext.AbstractComponent.getPlugin() issue?
I can't acces an AbstractComponent child class plugins using the Ext.AbstractComponent.getPlugin(id) method.
The method returns undefined. Nevertheless, I can call getPlugin() without argument and the method returns the (only) registered plugin.
Code excerpt:
Code:Ext.define('SomeModel', { extend: 'Ext.data.Model', fields: [{name: 'id', type: 'int'}], validations: [] }); var composition_grid = new Ext.grid.Panel({ id: 'abc-grid', width: 800, height: 200, plugins: [new Ext.grid.plugin.RowEditing({id:'rowediting'})], store: Ext.create('Ext.data.Store', { model: 'SomeModel' }), columns: [{ header: "ID", dataIndex: 'id', editor: { xtype: 'textfield', allowBlank: false } }], dockedItems: [{ xtype: 'toolbar', items: [{ text: 'Test', handler: function(){ console.log('getPlugin():', this.up('gridpanel').getPlugin(); console.log('getPlugin('rowediting'):', this.up('gridpanel').getPlugin('rowediting'); } }] }] });Last edited by damien.corpataux; 29 Apr 2011 at 12:32 AM. Reason: Fixed title syntax
-
2 May 2011 1:54 AM #2
hi, try to use "itemId" instead of "id":
and this works:Code:[...] plugins: [new Ext.grid.plugin.RowEditing({itemId:'rowediting'})],
Code:this.up('gridpanel').getPlugin('rowediting');Kender is not a thief!
-
2 May 2011 5:09 AM #3
Thank you for your anwser.
After testing, both itemId and id config options do not work.
After a brief dip into AbstractComponent source, it turns out that using the undocumented pluginId internal does the trick as an (ugly) workaround.
I don't have time to dig further. However, it seems reasonable that the pluginId property should be set from the config options' id or itemId at instanciation time.
I believe is a problem here, because it is common to compose Components with Plugins using the config options flavour - and fetching a plugin using its id seems to be quite common.
[...]
plugins: [new Ext.grid.plugin.RowEditing({pluginId:'rowediting'})],
this.up('gridpanel').getPlugin('rowediting');Last edited by damien.corpataux; 2 May 2011 at 5:29 AM. Reason: Updated reply after testing
-
2 May 2011 5:21 AM #4
You want to specify the pluginId:
Code:Ext.require('*'); Ext.define('SomeModel', { extend: 'Ext.data.Model', fields: [{ name: 'id', type: 'int' }] }); Ext.onReady(function(){ var composition_grid = new Ext.grid.Panel({ width: 800, height: 200, renderTo: document.body, plugins: [new Ext.grid.plugin.RowEditing({ pluginId: 'rowediting' })], store: Ext.create('Ext.data.Store', { model: 'SomeModel' }), columns: [{ header: "ID", dataIndex: 'id', editor: { xtype: 'textfield', allowBlank: false } }], dockedItems: [{ xtype: 'toolbar', items: [{ text: 'Test', handler: function(){ console.log(this.up('gridpanel').getPlugin('rowediting')); } }] }] }); });Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
2 May 2011 5:44 AM #5
Thank you for wiping my doubts.
It would help to find a reference to pluginId in the API Doc.
Regards
-
2 May 2011 6:21 AM #6
yes "pluginId" is right..
sorry, I thought about pluginId and I write itemID
Kender is not a thief!
Thank you for reporting this bug. We will make it our priority to review this report.
Similar Threads
-
[CLOSED]css issue
By fallangor in forum Ext:BugsReplies: 1Last Post: 24 Apr 2011, 4:06 PM -
Ext.AbstractComponent.applyRenderSelectors() - added members are not destroyed?
By LesJ in forum Ext: DiscussionReplies: 0Last Post: 4 Apr 2011, 10:45 AM -
Suggestion about Ext.AbstractComponent#plugins
By Scott Murawski in forum Ext: DiscussionReplies: 0Last Post: 2 Mar 2011, 10:57 PM -
[CLOSED]Ext.AbstractComponent mixins
By gevik in forum Ext:BugsReplies: 5Last Post: 28 Feb 2011, 9:56 PM -
[CLOSED] Ext.Loader issue in IE8
By nak1 in forum Ext 3.x: BugsReplies: 6Last Post: 26 Jul 2010, 3:01 PM


Reply With Quote