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
    St. Louis, MO
    Posts
    33,582
    Vote Rating
    433
    Answers
    3102
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    You would have to create a new instance... something like new Ext.Panel({....})
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    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 almost 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
    110
    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