1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    9
    Vote Rating
    0
    crosslink06 is on a distinguished road

      0  

    Default 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).

    Thanks a lot!

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,642
    Vote Rating
    899
    Answers
    3573
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You would have to create a new instance... something like new Ext.Panel({....})
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User Sameer Khan's Avatar
    Join Date
    Oct 2011
    Location
    Bangalore, India
    Posts
    113
    Vote Rating
    0
    Answers
    2
    Sameer Khan is on a distinguished road

      0  

    Default


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

    });
    Sameer Khan

Thread Participants: 2