首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

Extjs4 initComponent 和 constructor 的一点有关问题

2012-07-05 
Extjs4 initComponent 和 constructor 的一点问题Ext.define(DynamicButtonText, {extend: Ext.button.

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');          });

热点排行