【问题标题】:Override listeners in ExtJs 4在 ExtJs 4 中覆盖侦听器
【发布时间】:2014-08-17 10:03:57
【问题描述】:

是否可以在 ExtJs 4 中覆盖侦听器。 我的代码如下:

Ext.define('app.view.SearchForm', {
extend: 'Ext.form.Panel',
alias : 'widget.searchform',
items: [
   {
     xtype: 'radiogroup',
     id: 'type',
     items: [
      {boxLabel: 'Individual', id: 'ind', name: 'clientType', value: 'x',inputValue: 'x', checked: true},
      {boxLabel: 'Non-Individual', id: 'nind', name: 'clientType', value: 'y', inputValue: 'y'}
    ],
    listeners: {
        change: function( radiogroup, checked ) {
     // event code here
     }
  }
  ]

  });

现在如何在一个新的 js 文件中覆盖监听器,如下所示:

Ext.define('app.view.newSearchForm',{   
override: 'app.view.SearchForm',
alias: 'widget.newSearchForm'
   // how to override the listener

});

是否可以像覆盖方法一样覆盖侦听器?

【问题讨论】:

    标签: extjs overriding listeners


    【解决方案1】:

    像这样使用

           //your code here
           groupExpand : function(view, node, group, eOpts){
               alert("Expand called by refresh");
           },
           initComponent: function() {
               this.superclass().initComponent.call(this);
               this.on('resize', this.groupExpand);
           }
            //your code
    

    覆盖 initComponent 方法以覆盖其他方法

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-01-13
      • 2018-08-29
      • 1970-01-01
      • 2014-03-29
      • 2011-12-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多