var test = new Ext.ux.MyComponent({
title : "测试面板",
html : "test",
renderTo : Ext.getBody()
});
// 创建&销毁
test.destroy();
test = null
b) 创建出来未使用,也未销毁
Ext.ns("Ext.ux");
Ext.ux.MyComponent = Ext.extend(Ext.Panel, {
initComponent : function(){
this.btnA = new Ext.Button({
text : "模式A",
handler : function(){}
});
this.btnB = new Ext.Button({
text : "模式B",
handler : function(){}
});
// btnA与btnB必有一个未纳入Toolbar管理,也未主动销毁
this.tbar = [this.mode==="a" ? this.btnA : this.btnB];
Ext.ux.MyComponent.superclass.initComponent.apply(this, arguments);
}
});
// 创建&销毁
var test = new Ext.ux.MyComponent({
title : "测试面板",
html : "test",
renderTo : Ext.getBody()
});
test.destroy();
test = null;