1. #1
    Sencha User
    Join Date
    Apr 2011
    Posts
    212
    Vote Rating
    3
    bweiler is on a distinguished road

      0  

    Default Viewport, ref, alias, xtype confusion

    Viewport, ref, alias, xtype confusion



    I've been trying to figure out the twitter example and I am having trouble understanding how some of the pieces fit together. Here are my questions:

    From Search.js:

    Code:
        refs: [
            {
                ref       : 'main',
                selector  : 'mainview',
                xtype     : 'mainview',
                autoCreate: true
            },
    * The selector and xtype are not explicitly defined in the Main.js container (aka. viewport). How is the selector in refs or xtype in refs used to identify the 'Twitter.view.Main' container?

    * Why are selector and xtype both specified? Isn't only one of them needed?

    * Is the alias property (widgets) of Containers used by refs in any way?

    * If autoCreateViewport is used in the app definition, will autoCreate automatically put the mainview panel in the viewport?


    Thanks,

    Bruce


  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,756
    Vote Rating
    828
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    The selector is used with ComponentQuery to get the reference of that selector and cache it. The ref is for the name or the getter method that is automatically created, first character will be capitalized (in your example, 'main' will be transformed into 'getMain'). selector is ComponentQuery, if you have autoCreate set to true and there is no instance found, an instance will be created based on the xtype.

    The alias property is definitely used. alias is a two part string, first is the type of alias and the second is the xtype which is used for ComponentQuery and instantiation.

    autoCreate will only create an instance if there is not already an instance that matches the selector and if you execute the getter method that is created. So autoCreateViewport will create the Viewport class but in your controller you would have to call the getter method before the autoCreateViewport is executed to have a problem which isn't possible currently.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Dec 2011
    Posts
    18
    Vote Rating
    0
    jiancha is on a distinguished road

      0  

    Default


    How is the xtype: mainview in refs used to identify the 'Twitter.view.Main' container?
    this quest is still not answered yet, can you help us please ?
    best regards !

Thread Participants: 2

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..." hd porno faketaxi