1. #1
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    557
    Vote Rating
    25
    Answers
    8
    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
    Gainesville, FL
    Posts
    37,525
    Vote Rating
    871
    Answers
    3564
    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


    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
    ________________
    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