1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    52
    Vote Rating
    2
    michael.parrott is on a distinguished road

      0  

    Default Using alias or xtype?

    Using alias or xtype?


    I was wondering what the different between defining the alias of your class or the xtype of your class was. For a view, you can put alias: 'widget.home' or xtype: 'home' at the top and later on reference the view using the xtype of 'home'. What's the point of having both?

    Code:
    Ext.define( 'App.view.Home',
    {
     extend: 'Ext.Container',
     alias: 'widget.home',
     xtype: 'home' //accomplishes the same as above
    } );

  2. #2
    Sencha Premium Member
    Join Date
    Apr 2011
    Posts
    20
    Vote Rating
    0
    salorob is on a distinguished road

      0  

    Default


    +1.

    Am curious also.

  3. #3
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    529
    Vote Rating
    17
    estesbubba will become famous soon enough

      0  

    Default


    xtype is the newer way and of course preferred...I think

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,735
    Vote Rating
    756
    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

      1  

    Default


    Using xtype is just simpler and easier for people to get started using it. It actually sets up the alias.

    To understand what they are, the alias is a two part value separated by a single period:

    [alias type].[type]

    alias type is is the type of alias (that's not too descriptive is it? ). Values can be like widget (components), store, proxy, reader, etc.

    type is the shorthand type of the class. This is the xtype for components or the widget alias type.

    So if you have

    Code:
    alias : 'widget.mycomponent'
    that is the same as

    Code:
    xtype : 'mycomponent'
    IF you have:

    Code:
    alias : 'store.mystore'
    You can then create the store like:

    Code:
    store : {
        type : 'mystore'
    }
    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.

  5. #5
    Sencha User
    Join Date
    Jun 2012
    Posts
    52
    Vote Rating
    2
    michael.parrott is on a distinguished road

      0  

    Default


    Makes sense.
    Also, should that last piece of code be:
    Code:
    store:
    {
     xtype: 'mystore'
    }
    ?

  6. #6
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,735
    Vote Rating
    756
    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


    No, just type. xtype is only for components
    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.

Thread Participants: 3

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar