1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    82
    Answers
    4
    Vote Rating
    3
    matfin is on a distinguished road

      0  

    Default Answered: Accessing instance of view created with Ext.Define

    Answered: Accessing instance of view created with Ext.Define


    Looking at the following code

    Code:
    var mainpanel = Ext.define("App.view.Main", {
        extend: 'Ext.tab.Panel',
        xtype: 'mainpanel',
        id: 'mainpanel',
        config: {
        	fullscreen: true,
            tabBarPosition: 'left',
            items: [
                {
                    xtype: 'homepanel'
                }, 
               {
                	xtype: 'settingspanel'
                }
            ]
        }
    });
    How can I access the instance of this created panel ?


  2. #2
    Sencha - Training Team mrsunshine's Avatar
    Join Date
    Sep 2008
    Location
    Germany - Darmstadt
    Posts
    691
    Answers
    21
    Vote Rating
    12
    mrsunshine will become famous soon enough

      0  

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    82
    Answers
    4
    Vote Rating
    3
    matfin is on a distinguished road

      0  

    Default Thanks

    Thanks


    Hi

    Thanks for the reply. That does indeed work (somewhat) and it caught me out when trying to access 'homepanel'. Here is how I refined it:

    -- Ext.ComponentQuery.query('homepanel'); - this returns an array of all components with the xtype 'homepanel' even if there is only one. Trying to access this directly won't work

    --
    Ext.ComponentQuery.query('homepanel')[0]; - this will access the actual 'homepanel' component directly, which is exactly what I needed.

    Another pitfall that caught me. When the function animateActiveItem() is called in the following way:

    Code:
    this.getMain().animateActiveItem(
    {
        xtype: 'homepanel'
    },
    {
        type: 'fade'
    });
    It creates another instance of the homepanel, so each time the above function is called (from a controller for example) it clones the homepanel. The correct way to do this would be as follows:

    Code:
    this.getMain().animateActiveItem(Ext.ComponentQuery.query('homepanel')[0], {type: 'fade'});


    Hope this helps others who run into this problem in the future.

    Thanks again,

    Matt

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."