读书人

Extjs4 initComponent 和 constructor

发布时间: 2012-07-05 07:59:18 作者: rapoo

Extjs4 initComponent 和 constructor 的一点问题

Ext.define('DynamicButtonText', {              extend: 'Ext.button.Button',                   initComponent: function() {                  this.text = "ss";                  alert("alert in initComponent second")                   this.renderTo = Ext.getBody();                     },              constructor:function(){                this.text = new Date();                  alert("alert in constructor first")                  //如果initComponet,constructor同时存在callParent必须写在constructor中                  //否则initComponet中的内容不执行                  this.callParent();               },              scope:this          });               Ext.onReady(function() {              Ext.create('DynamicButtonText');          });

读书人网 >JavaScript

热点推荐