from:
http://cesclub.com/bw/jishuzhongxin/Webjishu/2012/0613/32122.html
<strong style="color:#000;background:#ffff66">Ext</strong>.define(""DynamicButtonText"", {
extend: ""<strong style="color:#000;background:#ffff66">Ext</strong>.button.Button"",
<strong style="color:#000;background:#66ffff">initComponent</strong>: function() {
this.text = "ss";
alert("alert in <strong style="color:#000;background:#66ffff">initComponent</strong> second")
this.renderTo = <strong style="color:#000;background:#ffff66">Ext</strong>.getBody();
},
constructor:function(){
this.text = new Date();
alert("alert in constructor first")
//若是initComponet,constructor同时存在<strong style="color:#000;background:#ffcc99">callParent</strong>必须写在constructor中
//不然initComponet中的内容不履行
this.<strong style="color:#000;background:#ffcc99">callParent</strong>();
},
scope:this
});
<strong style="color:#000;background:#ffff66">Ext</strong>.onReady(function() {
<strong style="color:#000;background:#ffff66">Ext</strong>.create(""DynamicButtonText"");
});