What is the difference between xtype and alias used in Sencha? They're both seem to be used as shorthand in different places.
When you use "alias" to declare an xtype, you have to preface it with "widget".
Example:
{
...
alias: 'widget.mycomponent'
...
}
When you use the xtype property, you can leave the "widget." part off, because that part is assumed:
Example:
{
...
xtype: 'mycomponent'
...
}
The reason for the two different properties is because you can declare aliases of things other than "widget", like alias: 'layout.card', which is used in the framework. However, for end-user code that reference view objects, you'll probably be using either
alias: 'widget.mycomponent'
or
xtype: 'mycomponent'
This is really confusing, even Sencha Touch developers team does not have a common opinion.
As far as I know, they design this merely for performance. Alias appears earlier than xtype, they create xtype config because if we don't have to parse the string to get the xtype like before, it's faster.
Anyway, things like xtype, ptype, ltype or most common, alias should be unified and clarified in next releases, said the dev team.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With