1. #1
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    507
    Vote Rating
    18
    Answers
    4
    estesbubba will become famous soon enough estesbubba will become famous soon enough

      0  

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

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,682
    Vote Rating
    435
    Answers
    3111
    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


    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.