Xtype instead of an alias in the class definition

Is there a difference between the two following methods for defining a class?

Ext.define("Test", { extend: "Ext.grid.Panel", xtype: "test" }); Ext.define("Test", { extend: "Ext.grid.Panel", alias: "widget.test" }); 
+5
source share
2 answers

It is said that the alias is faster, but I do not think you will notice. I use an alias when I define classes and xtype when creating objects, just a personal convention, so I'm not confused.

+4
source

As Eddie said, in the case of a xtype there is no difference in the results.

But alias property may be more xtype ...

The main difference is that alias can be used to define all types of aliases (widgets, plugins, functions, layouts, etc.), and xtype already a definite shorthand for the type of alias, a widget , so if you use xtype , you can only define widgets, nothing more. In addition, the alias property makes code more readable and therefore the first choice when writing class definitions.

Here are the common aliases of versions 4.2.3

  • Union
  • axis
  • data
  • straight
  • Editing
  • Function
  • formaction
  • idgen
  • location
  • plugin
  • proxies
  • reader
  • the choice
  • series
  • state
  • score
  • widget
  • Author
+16
source

Source: https://habr.com/ru/post/1208999/


All Articles