码迷,mamicode.com
首页 > Web开发 > 详细

ExtJS Alias, xtype and widget

时间:2016-01-19 23:25:42      阅读:207      评论:0      收藏:0      [点我收藏+]

标签:

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

 

ExtJS Alias, xtype and widget

标签:

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!