Better way to call superclass method in ExtJS

后端 未结 6 1476
梦如初夏
梦如初夏 2020-12-24 06:30

All the ExtJS documentation and examples I have read suggest calling superclass methods like this:

MyApp.MyPanel = Ext.extend(Ext.Panel, {
  initComponent: f         


        
6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-24 07:01

    I think this is solved in ExtJS 4 with callParent.

    Ext.define('My.own.A', {
        constructor: function(test) {
            alert(test);
        }
    });
    
    Ext.define('My.own.B', {
        extend: 'My.own.A',
    
        constructor: function(test) {
            alert(test);
    
            this.callParent([test + 1]);
        }
    });
    

提交回复
热议问题