【发布时间】:2016-01-08 09:40:37
【问题描述】:
我们有用 Extjs 4 编写的 js 文件。我必须将这些迁移到 Extjs 6。几乎一切都很好,但是当我们 create 自己的类(扩展的 extjs 类)时,我们遇到了问题。 (不幸的是没有 mvc,只有类和create)。在 ext-all-debug 中:
create: function(config, defaultType) {
if (typeof config === 'string') {
return Ext.widget(config);
}
if (config.isComponent) {
return config;
}
if ('xclass' in config) { // **config is true**
return Ext.create(config.xclass, config);
}
return Ext.widget(config.xtype || defaultType, config);
},
config 是 true,除了一个对象,我们在控制台中收到以下错误消息:“Cannot use 'in' operator to search 'xclass' in true”
我们的类或创建有什么问题?
这是一个类:
Ext.define("My.component.TrunkListGrid", {
extend: "My.component.Grid",
// config
viewConfig: {
enableTextSelection: true
},
initComponent: function () {
// ...
Ext.apply(this, {
// ...
});
this.callParent();
this.addListener('render', function () {
// ...
}, this);
}
});
这是一个创建:
var g = Ext.create('My.component.TrunkListGrid', {
// config
});
我想,我必须用另一种方式称呼一些东西......
【问题讨论】:
-
请出示你的失败班级的代码。几乎每个浏览器都会为您提供完整的堆栈跟踪,请将其附加到您的问题中。
-
我认为每个自己的课程都失败了。 :(
-
那么,请展示一些 Ext.create 示例。
-
请显示您的
dockedItems配置,它似乎是true或包含至少一个值true的数组。 -
tbar: this.showTbar ? {items: tbItems} : undefined,
标签: extjs extjs4 extjs6 extjs6-classic