现在的位置: 首页 > 综合 > 正文

Ext.extend

2012年04月27日 ⁄ 综合 ⁄ 共 555字 ⁄ 字号 评论关闭
    Ext.MyWindow = Ext.extend(Ext.Window, {
        width: 300
        , height: 200
        , addButtons: function () {
            if (!this.buttons) {
                this.buttons = [];
            }
            Ext.each(arguments, function (arg) {
                this.buttons.push(arg);
            }, this)
        }
        , initTools: function () {
            Ext.MyWindow.superclass.initTools.call(this);
            console.log("initTools");
            this.addButtons([{ text: "提交", handler: this.submit.createDelegate(this) }, 
{ text: "关闭", handler: this.hide.createDelegate(this)}])
        }
        , hide: function () {
            Ext.MyWindow.superclass.hide.call(this);
        }
        , submit: function () {
            Ext.Msg.alert("X");
        }

    });
    Ext.onReady(function () {
        var win = new Ext.MyWindow();
        win.show();

    });

抱歉!评论已关闭.