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);
}