-
3 Aug 2012 7:33 AM #1
Unanswered: Ext.create() with xtype in config?
Unanswered: Ext.create() with xtype in config?
I'm converting a Touch 1.1 app to 2.0 and we have dynamic object creation from server data and do an Ext.create({xtype: 'xxx', ...}). I've looked all through the API and can't figure out how to do this with 2.0.
-
4 Aug 2012 7:25 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,682
- Vote Rating
- 435
- Answers
- 3111
That is not supported. Ext.create takes 2 parameters, the class name and the config object. Ext.widget also takes 2 params, the xtype and the config object. You would need to create your own:
Code:Ext.createWidget = function(config) { //<debug> if (!config.xtype) { Ext.Logger.warn('You must specify an xtype in your config object.'); return; } //</debug> return Ext.widget(config.xtype, config); };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.


Reply With Quote