Results 1 to 5 of 5

Thread: 4.1 b2 possible bug in Ext.data.Model

  1. #1
    Sencha User
    Join Date
    May 2011
    Location
    Ukraine, Rivne
    Posts
    250
    Vote Rating
    44
      0  

    Default 4.1 b2 possible bug in Ext.data.Model

    When i added field with name "default" to model
    Code:
    Ext.define('ExampleModel', {
        extend: 'Ext.data.Model',
        fields: [
            { name: 'model_id', type: 'int' },
             { name: 'default' }
        ],
        idProperty: 'model_id',
        proxy: {
            type: 'ajax',
            api: {
                create: '/catalog/attribute/create/',
                read: '/catalog/attribute/',
                update: '/catalog/attribute/update/',
                destroy: '/catalog/attribute/delete/'
            },
            reader: {
                type: 'json',
                root: 'data'
            }
        }
    });
    i got error
    Code:
    missing variable name
    
    default = fields.get("default"),ext-all-debug.js (line 46224, col 4)
    
    
     http://*/assets/ext-4.0.7/ext-all-debug.js/eval/seq/22
    Line -19149
    after trying to load model with this field
    Code:
    Ext.ModelMgr.getModel('ExampleModel').load(1, {callback: function() {console.log(arguments);}});
    i got error
    Code:
    TypeError: this.proxy is undefined
    http://*/assets/ext-4.1.0-beta-2/ext-all-debug.js
    Line 46224
    //wbr
    Last edited by redraid; 16 Feb 2012 at 8:34 AM. Reason: Fixed error in field list

  2. #2
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,050
    Vote Rating
    1381
      0  

    Default

    So you did this and got the error:

    Code:
    Ext.define('ExampleModel', {
        extend: 'Ext.data.Model',
        fields: [
            { name: 'model_id', type: 'int' },
            { name: 'default' }
        ],
        idProperty: 'model_id',
        proxy: {
            type: 'ajax',
            api: {
                create: '/catalog/attribute/create/',
                read: '/catalog/attribute/',
                update: '/catalog/attribute/update/',
                destroy: '/catalog/attribute/delete/'
            },
            reader: {
                type: 'json',
                root: 'data'
            }
        }
    });
    I would think you would as default is a reserved word in JavaScript.
    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

  3. #3
    Sencha User
    Join Date
    May 2011
    Location
    Ukraine, Rivne
    Posts
    250
    Vote Rating
    44
      0  

    Default

    Yes, i miss {name: 'default'} field when copy-paste and clean code, with 4.0.7 no errors

  4. #4
    Sencha User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    18,984
    Vote Rating
    933
      0  

    Default

    This issue is already fixed for b3, thanks for the report.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  5. #5
    Sencha User
    Join Date
    May 2011
    Location
    Ukraine, Rivne
    Posts
    250
    Vote Rating
    44
      0  

    Default

    I should specify that in the 4.1 b2 names of the js control structures can not be field names.

    //wbr

Posting Permissions

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