Results 1 to 2 of 2

Thread: Ext.create() with xtype in config?

  1. #1
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    631
    Answers
    10
    Vote Rating
    41
      0  

    Default 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 - Community Support Team mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,025
    Answers
    3976
    Vote Rating
    1334
      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 @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •