30 Oct 2012 11:55 AM #1
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:
var b = new Ext.Button(config); var b = Ext.create('Ext.Button', config)
1 Nov 2012 5:15 AM #2
- Join Date
- Mar 2007
- Gainesville, FL
- Vote Rating
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 @LikelyMitch
Sencha Inc, Senior Software Engineer
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
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 email@example.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.