在ExtJS4中替换Ext.reg()(xtype)? [英] Replacing Ext.reg() (xtype) in ExtJS4?

查看:417
本文介绍了在ExtJS4中替换Ext.reg()(xtype)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Ext JS 4中使用3.3中的MultiSelect,如上一个问题所述:

I want to use the MultiSelect from 3.3 in Ext JS 4, as described in this previous question:

为什么Ext JS多选项目选择器文件不是包含在Ext JS 3.3下载中,它们在哪里?

看起来像注册 xtypes 已经在Ext JS 4.当我尝试导入这个小部件以及ItemSelector.js时,我在Ext.reg()上收到一个错误。

It seems like the way to register xtypes has changed in Ext JS 4. When I try to import this widget,along with ItemSelector.js, I get an error on Ext.reg().


Ext.reg('multiselect', Ext.ux.form.MultiSelect);

//backwards compat
Ext.ux.Multiselect = Ext.ux.form.MultiSelect;

如何将wdigets更改为让他们在Ext JS 4中工作?

How do I change wdigets to get them to work in Ext JS 4?

推荐答案

Ext JS 4的方法是使用新的类系统来创建你的widget :
http:// www.sencha.com/blog/countdown-to-ext-js-4-dynamic-loading-and-new-class-system/

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确保您使用widget命名空间为窗口小部件分配别名。例如:

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'
});

然后你可以通过xtype'multiselect'来引用小部件。当您在Ext JS 4中使用xtype时,它会查找具有widget[xtype]别名的类。

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]'.

这篇关于在ExtJS4中替换Ext.reg()(xtype)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆