1. #1
    Sencha User
    Join Date
    May 2011
    Location
    Ukraine, Rivne
    Posts
    250
    Vote Rating
    42
    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
    Gainesville, FL
    Posts
    37,642
    Vote Rating
    899
    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


    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
    ________________
    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
    May 2011
    Location
    Ukraine, Rivne
    Posts
    250
    Vote Rating
    42
    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
    17,148
    Vote Rating
    673
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      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
    250
    Vote Rating
    42
    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

Thread Participants: 2