ExtJS Alias, xtype and widget

Description

What is exactly the relationship between these three different concepts? I know that if you alias a class bywidget.name you can later use it by specifying xtype: 'name'. The same class can also be initialized byExt.widget('name'). But what about alias that do not start with 'widget'? Can they be lazily initialized? What if I want to directly specify the fully qualified class name to be lazily initialized instead of creating and using a xtype? Can that be done?

Answer

widget is not the only prefix option, there are many. Plugins use plugin, proxies use proxy, ... Take a look at the ExtJS source to see more.

xtype is a way to specify the component type in a config object. This is interpreted by a container to create the component. As containers can only contain components (and not plugins, proxies, etc.) it doesn't make sense to use xtypes with those other alias types.

However, the other alias types are used in other places. When you specify a proxy on a model or store it is the alias you are using in the type option. Similarly, readers, writers, plugins and grid features are often created using their alias. e.g. for a grid features you'd use the ftype.

If you take a look at the source to Ext.widget() it may give you some insight into how it works:

http://docs.sencha.com/ext-js/4-0/so...-method-widget

I don't believe there is a way to use the class name instead.

Reference

原文地址:https://www.cnblogs.com/yuxiaoqi/p/5143580.html