Exception ExtJS 4:Ext.grid.Panel构造函数在实现配置和构造函数配置时引发异常

Exception ExtJS 4:Ext.grid.Panel构造函数在实现配置和构造函数配置时引发异常,exception,extjs,extjs4,config,Exception,Extjs,Extjs4,Config,我试图在ExtJS4中将一个名为“hideButton”的自定义参数传递给我的网格视图构造函数。当我将“config”和“constructor”配置添加到我的网格视图中时,框架正在抛出一个异常uncaughttypeerror:无法读取未定义的属性“added”。警报消息确实会被调用。在我点击警报对话框上的“OK”后调用此异常。是什么导致此异常 Ext.define('App.view.ExampleGrid', { extend: 'Ext.grid.Panel', xtyp

我试图在ExtJS4中将一个名为“hideButton”的自定义参数传递给我的网格视图构造函数。当我将“config”和“constructor”配置添加到我的网格视图中时,框架正在抛出一个异常
uncaughttypeerror:无法读取未定义的属性“added”。警报消息确实会被调用。在我点击警报对话框上的“OK”后调用此异常。是什么导致此异常

Ext.define('App.view.ExampleGrid', {
    extend: 'Ext.grid.Panel',
    xtype: 'view-grid-3',

    config: {   

        hideButton: false
    },

    constructor: function(cfg) {

        alert('called constructor');
        this.initConfig(cfg);
    },

我正在通过“xtype”配置使用惰性实例化从另外两个不同的组件实例化网格视图。下面是需要通过调用构造函数在网格视图中隐藏按钮的组件

items: [{
    region: 'center',
    xtype: 'view-tree-3',
    width: '40%'
}, {
    region: 'east',
    xtype: 'view-grid-3',
    store: 'GridStore',
    config: {
        hideButton: true
    },
    width: '60%'        
}]

假设您不能在extjs4.x中使用
config
块。这是目前唯一的触摸功能

要在派生类中添加或重写配置选项,请将配置选项放在类声明体的右侧:

Ext.define('App.view.ExampleGrid', {
    extend: 'Ext.grid.Panel',

    hideButton: false,

    ...
});
实例化时,请对实例配置执行相同操作:

my grid = new App.view.ExampleGrid({
    hideButton: true // Overriding the default for this instance
});

啊。谢谢如何在实例化之前将自定义值传递给视图?添加了几个示例,请参见上文。使用上面的代码后,我得到了以下异常:“未捕获引用错误:未定义hideButton”Nevermind。。。我必须通过这样做来实现自定义配置:“hidden:this.hideButton”。。。。一切都很好!