Results 1 to 3 of 3

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

    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
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,551
    Vote Rating
    1271
      0  

    Default

    Thank you for the report.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Oct 2011
    Location
    Sweden
    Posts
    36
    Vote Rating
    0
      0  

    Default

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

Tags for this Thread

Posting Permissions

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