Is there any difference between the two following class definition methods?
Ext.define("Test", {
extend: "Ext.grid.Panel",
xtype: "test"
});
Ext.define("Test", {
extend: "Ext.grid.Panel",
alias: "widget.test"
});
As Eddy already stated, there is no difference in the result in case of a xtype
.
But the alias property can more then a xtype...
The main difference is that alias
can be used to define all sort of aliases (widgets, plugins, features, layouts, etc.) while xtype
already is a specific shorthand for a alias type, a widget
. So if you use xtype
you can only define widgets, nothing else. In addition the alias
property makes the code a bit more readable and should therefore be the first choice when writing class definitions.
Here are the common aliases of versions 4.2.3
It is said that the alias is faster, but I don't think you will notice. I use alias when defining classes and xtype when creating objects, just a personal convention, so I don't get confused.
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