1. #1
    Sencha User daubman's Avatar
    Join Date
    Jul 2010
    Location
    Massachusetts
    Posts
    34
    Vote Rating
    2
    daubman is on a distinguished road

      0  

    Question Correct way to obtain component references?

    Correct way to obtain component references?


    When using Designer 1.2.2-48 exported code, which unfortunately doesn't adhere to the new MVC standards, what is the correct way to obtain references to components?

    e.g. for the following code (view, not the ui) there are no getters created for the refs or stores:

    Code:
    Ext.define('LaunchEventWindow.view.MyViewport', {
        extend: 'LaunchEventWindow.view.ui.MyViewport',
    
        refs: [{
            // A component query
            selector: 'viewport > gridpanel',
            ref: 'lewGridPanel'
        }],
    
        stores: ['LaunchEvents'],
    
        initComponent: function() {
            var me = this;
            me.callParent(arguments);
    
            var myStore = getLaunchEventsStore(); //FAILS, does not exist
    
            var myPanel = getLewGridPanel(); //FAILS, does not exist
            console.debug(myPanel.getId());
        }
    });
    What is the correct way to get a reference to the viewport INSTANCE (or the gridpanel within the viewport) when not using the MVC code with the controllers, etc... as specified here:
    http://docs.sencha.com/ext-js/4-0/#!/guide/mvc_pt3
    Last edited by daubman; 23 Nov 2011 at 1:58 PM. Reason: cleaning up code formatting

  2. #2
    Sencha Premium Member lorezyra's Avatar
    Join Date
    Dec 2007
    Location
    Japan -- 日本
    Posts
    583
    Vote Rating
    6
    lorezyra will become famous soon enough

      0  

    Default store lookup

    store lookup


    Try this...

    PHP Code:
    Ext.StoreMgr.lookup("lewGridPanel"); 
    Perfection as a goal is a nice idea that can point one in a specific direction. However, since "perfection" is an ever changing (evolving?) and moving target, one must admit that perfection can never be obtained...

    When in doubt, check the d4mn source code!

  3. #3
    Sencha Premium Member lorezyra's Avatar
    Join Date
    Dec 2007
    Location
    Japan -- 日本
    Posts
    583
    Vote Rating
    6
    lorezyra will become famous soon enough

      0  

    Default


    Quote Originally Posted by daubman View Post
    ...
    What is the correct way to get a reference to the viewport INSTANCE (or the gridpanel within the viewport) when not using the MVC code with the controllers, etc... as specified here:
    http://docs.sencha.com/ext-js/4-0/#!/guide/mvc_pt3
    Alternately, for components, you can still go old-school with Ext.getCmp()... You may notice many of the 4.0 examples still use the old 3.x logic and not so much the MVC scheme...
    Perfection as a goal is a nice idea that can point one in a specific direction. However, since "perfection" is an ever changing (evolving?) and moving target, one must admit that perfection can never be obtained...

    When in doubt, check the d4mn source code!

Thread Participants: 1

Tags for this Thread