繁体   English   中英

Extjs 4.1:如此奇怪的错误:未捕获TypeError:无法读取未定义的属性'items'

[英]Extjs 4.1: So strange error: Uncaught TypeError: Cannot read property 'items' of undefined

你可以改变样本: app/simple/app/Viewport.js到这个:

您将在Chrome控制台中收到此错误消息:

未捕获的TypeError:无法读取未定义的ext-all.js的属性'items':18 Ext.cmd.derive.getDockedItems

但如果你评论这个:

initComponent : function() {
                            this.callParent();
                        },

一切都好。

Ext.define('AM.view.Viewport', {
        extend : 'Ext.container.Viewport',

        layout: 'border',
        items : [{
                    border : false,
                    region : 'north',
                    xtype : 'progressbar',
                    text : 'Ready',
                    height : 20
                }, {
                    region : 'west',
                    xtype : 'userlist',
                    width:300
                }, {
                    region : 'center',
                    xtype : 'treepanel',
                    initComponent : function() {
                        this.callParent();
                    },
                    columns : [{
                                xtype : 'treecolumn',
                                sortable : false,
                                width : 200,
                                text : 'lala',
                                dataIndex : 'text'
                            }, {
                                flex : 1,
                                sortable : false,
                                text : 'haha',
                                dataIndex : 'pars'
                            }]
                }]
    });

1-尝试使用这样的Parents参数调用:

.
.
.
,initComponent : function() {
 this.callParent(arguments);
 },
.
.
.

或者调用超类:

.
.

,initComponent : function() {
     this.callSuper(arguments);
 },
.
.
.

initComponent仅适用于新定义的组件。 在您的情况下'AM.view.Viewport'。 您不能覆盖作为项目中组件的配置插入的组件的initComponent。 如果要为该treepanel定义initComponent,则必须对其进行扩展,然后将此扩展名放入视口的项目中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM