[英]Extjs opening new Ext.window.Window by clicking a button
I'm trying to edit open source program called PartKeepr (v0.1.9). 我正在尝试编辑名为PartKeepr(v0.1.9)的开源程序。 In a specific part of program I want to add a button that opens a new Ext.window.Window.
在程序的特定部分,我想添加一个打开新的Ext.window.Window的按钮。 My codes are as following which doesn't work (I'm pretty new in extjs but I'm given a hard task I guess, so I'm open to all advice for where to start learning, I'm just trying to learn from existing codes and apply some things by looking similar parts of available code)
我的代码如下,但不起作用(我在extjs中很新,但我想我已经完成了一项艰巨的任务,因此我愿意接受所有关于从哪里开始学习的建议,我只是在尝试学习从现有代码中查找并通过查找可用代码的相似部分来应用某些内容)
Ext.define('PartKeepr.FindWindow',{
extend:'Ext.window.Window',
constrainHeader: true,
title: i18n("Find Number"),
initComponent: function() {
this.okButton=Ext.create("Ext.button.Button",{
text:i18n("OK")});
this.buttons=[this.okButton];
}
});
{
xtype: 'button',
text: i18n("Find"),
name: 'findButton',
handler: Ext.bind(this.findNumber, this)
}
findNumber: function(){
var j = new PartKeepr.FindWindow();
j.show();
}
Edit: When I press the find button, console giving me the following error: ext-all.js:21 Uncaught TypeError: Cannot read property 'insert' of undefined 编辑:当我按下查找按钮时,控制台给我以下错误:ext-all.js:21 Uncaught TypeError:无法读取未定义的属性“插入”
You need to call the superclass initComponent method: 您需要调用超类的initComponent方法:
Ext.define('PartKeepr.FindWindow', {
extend: 'Ext.window.Window',
constrainHeader: true,
title: i18n("Find Number"),
initComponent: function() {
this.okButton = Ext.create("Ext.button.Button", {
text: i18n("OK")
});
this.buttons = [this.okButton];
this.callParent();
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.