Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-7250 in 4.1.3.
  1. #1
    Sencha Premium Member
    Join Date
    Feb 2012
    Location
    Coral Gables, FL
    Posts
    3
    Vote Rating
    0
    frankcastro is on a distinguished road

      0  

    Default Ext.application models config array does not actually load models.

    Ext.application models config array does not actually load models.


    Although this isn't a huge issue, I don't believe that adding the Model class to the models config array actually loads the Model.js class.

    It only loads the model class, if you place a Store in the stores config array that references that model.

    The only way this works is to explicitly add the Model.js in the requires config array.

    Again, this is not a huge issue, but it doesn't work.

    In the code below, the model class is never loaded, and I get an error:

    app.js:
    Code:
    Ext.Loader.setConfig({
        enabled: true
    });
    Ext.application({
        name: 'Test',
        models: ['SomeModel'],
        launch: function() {
            var someModel = this.getModel('SomeModel');
            someModel.load(1, {
                success: function(model) {
    
    console.log(model); // error: Uncaught TypeError: Cannot call method 'load' of undefined }
    } });
    index.html:
    Code:
    <html>
        <head>    
            <title>Test</title>
            <link href="../extJS/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
           <script type="text/javascript" src="../extJS/ext-debug.js"></script>
        </head>
        <body></body>
        <script type="text/javascript" src="app.js"></script>
    </html>
    SomeModel.js:
    Code:
    Ext.define('Test.model.SomeModel', {
        extend: 'Ext.data.Model',
        fields: [
            {name: 'id', type: 'string'},
            {name: 'last_name', type: 'string'},
            {name: 'first_name', type: 'string'}
        ],
    
        proxy: {
            type: 'ajax',
            url: 'testdata/somemodeldata.json',
            reader: {
                type: 'json',
                root: 'data'
            }
        }
    
    
    });
    somemodeldata.json:
    Code:
    {
        "success": true,
        "data": [
            {"id": 1, "last_name": "Castro", "first_name": "Frank"},
            {"id": 2, "last_name": "Bower", "first_name": "Kelly"}
        ]
    }
    Frank Castro

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,399
    Vote Rating
    849
    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


    Thank you for the report.
    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.

  3. #3
    Sencha User
    Join Date
    Oct 2011
    Location
    Sweden
    Posts
    36
    Vote Rating
    0
    JambaFun is on a distinguished road

      0  

    Default


    FYI this seems to be more of an issue in IE.

Thread Participants: 2

Tags for this Thread