简体   繁体   English

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

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

you can change sample: app/simple/app/Viewport.js to this: 你可以改变样本: app/simple/app/Viewport.js到这个:

you'll get this error in Chrome console: 您将在Chrome控制台中收到此错误消息:

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

But if you comment this: 但如果你评论这个:

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

Everything is ok. 一切都好。

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- try to call with the Parents arguments like this: 1-尝试使用这样的Parents参数调用:

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

OR call the the super Class: 或者调用超类:

.
.

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

initComponent works only for the newly defined component. initComponent仅适用于新定义的组件。 In your case for 'AM.view.Viewport'. 在您的情况下'AM.view.Viewport'。 You can not override initComponent for component inserted as config of component in items. 您不能覆盖作为项目中组件的配置插入的组件的initComponent。 If you want to define initComponent for that treepanel, you have to extend it as well and then put this extension into items of your viewport. 如果要为该treepanel定义initComponent,则必须对其进行扩展,然后将此扩展名放入视口的项目中。

暂无
暂无

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

相关问题 extjs 4Uncaught TypeError:无法读取未定义的属性“ items” - extjs 4Uncaught TypeError: Cannot read property 'items' of undefined ExtJs错误:未捕获TypeError:无法读取未定义的属性'removeCls' - ExtJs Error: Uncaught TypeError: Cannot read property 'removeCls' of undefined Extjs5 treepanel [未捕获的TypeError:无法读取未定义的属性'create'] - Extjs5 treepanel [Uncaught TypeError: Cannot read property 'create' of undefined] ExtJS:未捕获的TypeError:无法读取未定义的属性“作用域” - ExtJS: Uncaught TypeError: Cannot read property 'scope' of undefined ExtJs:grid.reconfigure错误“未捕获的TypeError:无法读取未定义的属性'getProxy'” - ExtJs: grid.reconfigure Error “Uncaught TypeError: Cannot read property 'getProxy' of undefined” 未捕获的TypeError:无法读取未定义的属性'getProxy' - Uncaught TypeError: Cannot read property 'getProxy' of undefined 未捕获的类型错误:无法读取未定义的属性“isSynchronized” - Uncaught TypeError: Cannot read property 'isSynchronized' of undefined EXTJS 6 Modern:缓冲存储+网格:未捕获的TypeError:无法读取未定义的属性'length' - EXTJS 6 Modern: buffered store + grid: Uncaught TypeError: Cannot read property 'length' of undefined Extjs查看渲染问题,Uncaught TypeError:无法读取未定义的属性'tooNarrow' - Extjs view rendering issue,Uncaught TypeError: Cannot read property 'tooNarrow' of undefined ExtJS5 存储过滤器“未捕获的类型错误:无法读取未定义的属性‘get’” - ExtJS5 Store filter "Uncaught TypeError: Cannot read property 'get' of undefined"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM