【问题标题】:Error when assigning a Ext.grid.Panel to a Ext.tab.Panel将 Ext.grid.Panel 分配给 Ext.tab.Panel 时出错
【发布时间】:2011-06-03 09:29:15
【问题描述】:

我有一个标签面板,到目前为止工作正常, 但是,一旦我将网格面板应用为选项卡之一,我就会在 Observerable.js(ext 的一个类)中的某个地方收到一个 js 错误,它说“item.on(...)”不是'项目未定义'后的函数

以下是相应的代码行:

这就是我在标签面板中所做的:

initComponent: function() {
        this.items = [{
            xtype: 'profileList',
            title: 'Profiles'
        }];

    this.callParent(arguments);
}

这是我的网格面板的代码:

Ext.define('BC.view.profile.ProfileList', {
    extend: 'Ext.grid.Panel',
    alias: 'widget.profileList',

    cls: 'profileList',

    border: false,

    initComponent: function(){

        Ext.apply(this, {
            store: 'Profiles',

            columns: [{
                text: 'Name',
                dataIndex: 'name',
                flex: 1,
            }, {
                text: 'Others',
                dataIndex: 'otherUsers',
                width: 200
            }, {
                text: 'Limit',
                dataIndex: 'limit',
                width: 200
            }]
        });
        console.log('before');
        this.callParent(arguments);
        console.log('after');
    }

});

感谢您的帮助!

编辑:第一个 console.log 有效,错误似乎发生在 'callParent()'

【问题讨论】:

    标签: javascript extjs extjs4


    【解决方案1】:

    你不能这样创建标签面板的项目:

     this.items = [{
            xtype: 'profileList',
            title: 'Profiles'
        }];
    

    你应该使用 Ext.apply(... 代替:

    Ext.apply(this,{items:[{
            xtype: 'profileList',
            title: 'Profiles'
        }]);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-05-26
      • 2019-09-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多