开发者

How do you add listener to an existing listener object?

开发者 https://www.devze.com 2023-03-03 13:50 出处:网络
This doesn\'t work: Models.buttons.Del = Ext.extend(Ext.Button, { ,text: \'Del\' ,listeners: { 开发者_如何学C load: function() {

This doesn't work:

Models.buttons.Del = Ext.extend(Ext.Button, {
    ,text: 'Del'
    ,listeners: {
       开发者_如何学C load: function() {
        },
        ,click: function() {
        }
    }
});
Models.buttons.Add = Ext.extend(Models.buttons.Del, {
    ,text: 'Add'
    ,listeners: {
        ,click: function() {
        }
    }
});

load() event be lost in Add object.


you can use superclass to not to lose those methods. by doing this, you can also extend methods.

Models.buttons.Del = Ext.extend(Ext.Button, {
    ,text: 'Del'
    ,listeners: {
        load: function() {
        },
        ,click: function() {
        }
    }
});
Models.buttons.Add = Ext.extend(Models.buttons.Del, {
    ,text: 'Add'
    ,listeners: {
        load: function() {
            Models.buttons.Add.superclass.load.call(this);
        },
        ,click: function() {
        }
    }
});
0

精彩评论

暂无评论...
验证码 换一张
取 消