【问题标题】:Extjs 4 to 6 migration classesExtjs 4 到 6 个迁移类
【发布时间】: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);
},

configtrue,除了一个对象,我们在控制台中收到以下错误消息:“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


【解决方案1】:

哦,我找到了!我们在配置中使用了buttons: true

【讨论】:

    猜你喜欢
    • 2014-12-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多