【问题标题】:Extjs opening new Ext.window.Window by clicking a buttonExtjs 通过单击按钮打开新的 Ext.window.Window
【发布时间】:2016-08-08 15:01:39
【问题描述】:

我正在尝试编辑名为 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 property 'insert' of undefined

【问题讨论】:

    标签: javascript extjs extjs4.1


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-11-06
      • 1970-01-01
      • 2021-10-03
      • 2018-10-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多