Extjs通过单击按钮打开新的Ext.window.window

Extjs opening new Ext.window.Window by clicking a button

本文关键字:window Ext 单击 按钮 Extjs      更新时间:2023-09-26

我正在尝试编辑名为PartKeeper(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:无法读取未定义的属性"insert">

您需要调用超类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();
    }
});