Replacing Ext.reg() (xtype) in ExtJS4?

狂风中的少年 提交于 2019-12-01 02:57:20

The Ext JS 4 way is to use the new class system to create your widget: http://www.sencha.com/blog/countdown-to-ext-js-4-dynamic-loading-and-new-class-system/

Make sure you assign your widget an alias using the "widget" namespace. For example:

Ext.define('Ext.ux.form.MultiSelect', {
    extend: 'ClassNameYouAreExtending',
    alias: 'widget.multiselect'
});

Then you can refer to the widget by the xtype 'multiselect'. When you use an xtype in Ext JS 4 it looks for a class with an alias of 'widget.[xtype]'.

You will have to modify the code to get the MultiSelect component running on ExtJS 4. Here are few changes that you will have to do:

  1. Class definition. ExtJS 3.x used Ext.extend to extend. With the new version, you will have to use Ext.define

  2. In the new version, you can represent a class name as string. Due to this, I think you will not require the Ext.reg method anymore. The Component Manager class to not have register function.

Well, you're diving into pre-beta territory, so to some extent you're going to have to look at code and figure it out. There is some explanation of the new class system in the blog post introducing it, and there will be a comprehensive migration guide before 4.0 final comes out. I would definitely pursue this in the Sencha 4.0 forums though since that's where all the Ext 4 experts will be hanging out.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!