Unanswered: Improving Performance: Detroy then instantiate?
Unanswered: Improving Performance: Detroy then instantiate?
Hi all,
In order to improve performance of my application, I would like to destroy then instantiate a new card as often as possible during the user's navigation. In order to destroy it I only have to call mycard.detroy() but how can I instanciate it again? (My application's based on the Sencha 1.1 kitchen sink).
Hi, Add your all elements of a panel/FormPanel inside of onActivate() event...and declare on() for destroying the panel and to re initiate the same panel again...
var mainpanel = Ext.extend(Ext.form.FormPanel, {
scroll: 'vertical',
labelWidth: '40%',
defaults:{xtype: 'textfield'},
initComponent: function() {
Ext.oasis.adl.superclass.initComponent.call(this);
this.addListener( "activate", this.onActivate, this);
this.on('deactivate', function(cmp){cmp.destroy();},this,this);
},
onActivate: function(){
this.removeAll(true);
var panelItems=[{--},{---},....etc];
this.add(panelItems); this.doLayout();
}