87,907
社区成员
发帖
与我相关
我的任务
分享
Ext.MyWindow = Ext.extend(Ext.Window, {
width: 300,
height: 200,
helloWorld: function () {
Ext.msg.alert("Hello world!");
},
buttons: [
{ text: "调用 helloWorld 方法", handler: function () {
// 这样?
// Ext.MyWindow.helloWorld() ?
} }
]
});
Ext.onReady(function () {
var win = new Ext.MyWindow();
win.show();
});
Ext.MyWindow = Ext.extend(Ext.Window, {
initComponent: function () {
var btn1 = new Ext.Button({ text: 'hello', handler: function () { this.helloWorld(); }, scope: this });
this.buttons = [btn1];
Ext.MyWindow.superclass.initComponent.call(this);
},
width: 300,
height: 200,
helloWorld: function () {
alert("Hello world!");
}
});
Ext.onReady(function () {
var win = new Ext.MyWindow();
win.show();
});