Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Apr 2011
    Posts
    9
    Vote Rating
    0
    damien.corpataux is on a distinguished road

      0  

    Default [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. #2
    Sencha User kender's Avatar
    Join Date
    Jul 2009
    Location
    Italy
    Posts
    23
    Vote Rating
    0
    kender is on a distinguished road

      0  

    Default


    hi, try to use "itemId" instead of "id":

    Code:
    [...]
    plugins: [new Ext.grid.plugin.RowEditing({itemId:'rowediting'})],
    and this works:

    Code:
    this.up('gridpanel').getPlugin('rowediting');
    Kender is not a thief!

  3. #3
    Sencha User
    Join Date
    Apr 2011
    Posts
    9
    Vote Rating
    0
    damien.corpataux is on a distinguished road

      0  

    Default


    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

  4. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,901
    Vote Rating
    623
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    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!

  5. #5
    Sencha User
    Join Date
    Apr 2011
    Posts
    9
    Vote Rating
    0
    damien.corpataux is on a distinguished road

      0  

    Default


    Thank you for wiping my doubts.

    It would help to find a reference to pluginId in the API Doc.


    Regards

  6. #6
    Sencha User kender's Avatar
    Join Date
    Jul 2009
    Location
    Italy
    Posts
    23
    Vote Rating
    0
    kender is on a distinguished road

      0  

    Default


    yes "pluginId" is right..
    sorry, I thought about pluginId and I write itemID
    Kender is not a thief!

Similar Threads

  1. [CLOSED]css issue
    By fallangor in forum Ext:Bugs
    Replies: 1
    Last Post: 24 Apr 2011, 4:06 PM
  2. Replies: 0
    Last Post: 4 Apr 2011, 10:45 AM
  3. Suggestion about Ext.AbstractComponent#plugins
    By Scott Murawski in forum Ext: Discussion
    Replies: 0
    Last Post: 2 Mar 2011, 10:57 PM
  4. [CLOSED]Ext.AbstractComponent mixins
    By gevik in forum Ext:Bugs
    Replies: 5
    Last Post: 28 Feb 2011, 9:56 PM
  5. [CLOSED] Ext.Loader issue in IE8
    By nak1 in forum Ext 3.x: Bugs
    Replies: 6
    Last Post: 26 Jul 2010, 3:01 PM

Thread Participants: 2