簡體   English   中英

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:無法讀取未定義的屬性“插入”

您需要調用超類的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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM