Extjs 通过单击按钮打开新 Ext.window.Window
Extjs opening new Ext.window.Window by clicking a button
我正在尝试编辑名为 PartKeepr (v0.1.9) 的开源程序。在程序的特定部分,我想添加一个打开新 Ext.window.Window 的按钮。我的代码如下,但行不通(我在 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();
}
编辑:当我按下查找按钮时,控制台出现以下错误:ext-all.js:21 Uncaught TypeError: Cannot read 属性 'insert' of undefined
需要调用超类的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();
}
});
我正在尝试编辑名为 PartKeepr (v0.1.9) 的开源程序。在程序的特定部分,我想添加一个打开新 Ext.window.Window 的按钮。我的代码如下,但行不通(我在 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();
}
编辑:当我按下查找按钮时,控制台出现以下错误:ext-all.js:21 Uncaught TypeError: Cannot read 属性 'insert' of undefined
需要调用超类的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();
}
});