Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/374.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 未捕获类型错误:对象#<;对象>;没有方法';应用';错误_Javascript_Extjs4 - Fatal编程技术网

Javascript 未捕获类型错误:对象#<;对象>;没有方法';应用';错误

Javascript 未捕获类型错误:对象#<;对象>;没有方法';应用';错误,javascript,extjs4,Javascript,Extjs4,我点击编辑按钮时出现错误uncaughttypeerror:Object#没有方法“apply”。这是我的小组: Ext.define( "ux.panel.MyPanel", { extend : "Ext.form.Panel", xtype : "MyPanel", title : "Bla bla title" initComponent : function () { ux.panel.MyPanel.superclass.in

我点击编辑按钮时出现错误
uncaughttypeerror:Object#没有方法“apply”
。这是我的小组:

Ext.define(
    "ux.panel.MyPanel", {
    extend : "Ext.form.Panel",
    xtype : "MyPanel",
    title : "Bla bla title"

    initComponent : function () {
        ux.panel.MyPanel.superclass.initComponent.call(this);
    },
    init : function (initParameters) {
        this.initParameters = initParameters;

        this.removeAll(true);

        if (this.initParameters == null)
            return;
    },
    editSomething : function () {
        alert("editTV");
    },
    tbar : [{
            text : "Edit"
            iconCls : "silk-edit-16",
            id : "editbutton",
            disabled : false,
            listeners : {
                click : {
                    scope : this,
                    fn : this.editSomething
                }
            }
        }, {
            text : "Remove",
            iconCls : "silk-delete-16",
            id : "removeButton",
            disabled : false,
            listeners : {
                click : {
                    scope : this,
                    fn : function () {
                        alert("RemoveTV");
                    }
                }
            }
        }
    ]
});
此面板包含在由许多其他面板组成的页面中。我怀疑在这个编辑中,有什么东西没有指向我的面板。我不知道该怎么处理这件事


有人知道原因吗?

那是因为
这不是你所期望的

initComponent
函数中添加
tbar
,如下所示:

initComponent: function () {
    Ext.apply(this, {
        tbar: [{
            text: "Edit",
            iconCls: "silk-edit-16",
            id: "editbutton",
            disabled: false,
            listeners: {
                click: {
                    scope: this,
                    fn: this.editSomething
                }
            }
        }, {
            text: "Remove",
            iconCls: "silk-delete-16",
            id: "removeButton",
            disabled: false,
            listeners: {
                click: {
                    scope: this,
                    fn: function () {
                        alert("RemoveTV");
                    }
                }
            }
        }]
    });

    this.callParent(arguments);
}