1. #1
    Sencha User jep's Avatar
    Join Date
    Sep 2010
    Posts
    862
    Answers
    1
    Vote Rating
    21
    jep will become famous soon enough jep will become famous soon enough

      0  

    Default Unanswered: new Ext.Button(config) versus Ext.create('Ext.Button', config)

    Unanswered: new Ext.Button(config) versus Ext.create('Ext.Button', config)


    I have another best practices question. Say I'm creating a button dynamically one of two ways:

    Code:
    var b = new Ext.Button(config);
    
    var b = Ext.create('Ext.Button', config)
    Since I'm creating both immediately, it's not a question of lazy instantiation. I'm also not using xtypes but specific class names ("Ext.Button"). Is there a best practice on which of these two methods to use? I see Ext.create does a whole bunch of stuff, though a lot of it is to allow you to use something other than straight-up class names. I'm not sure what else it does that might be important.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,789
    Answers
    3465
    Vote Rating
    833
    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


    Best practices is to use Ext.create but I always use the new keyword as it is going to be more performant as you described Ext.create is doing some extra things to make sure the class is loaded. You just have to make sure you know the class is already loaded if you are going to use the new keyword.
    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.

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi