1. #1
    Sencha User
    Join Date
    May 2011
    Location
    Ukraine, Rivne
    Posts
    247
    Vote Rating
    40
    redraid has a spectacular aura about redraid has a spectacular aura about redraid has a spectacular aura about

      0  

    Default 4.1 b2 possible bug in Ext.data.Model

    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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,624
    Vote Rating
    435
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      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 @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    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 almost in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    May 2011
    Location
    Ukraine, Rivne
    Posts
    247
    Vote Rating
    40
    redraid has a spectacular aura about redraid has a spectacular aura about redraid has a spectacular aura about

      0  

    Default


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

  4. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    15,083
    Vote Rating
    97
    evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold

      0  

    Default


    This issue is already fixed for b3, thanks for the report.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  5. #5
    Sencha User
    Join Date
    May 2011
    Location
    Ukraine, Rivne
    Posts
    247
    Vote Rating
    40
    redraid has a spectacular aura about redraid has a spectacular aura about redraid has a spectacular aura about

      0  

    Default


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

    //wbr