Results 1 to 3 of 3

Thread: Ext.data.Model provided example bug.

    Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Ext Premium Member halcwb's Avatar
    Join Date
    Mar 2010
    Location
    Rotterdam
    Posts
    411

    Default Ext.data.Model provided example bug.

    REQUIRED INFORMATIONExt version tested:
    • Ext 4 rev 0.2.a
    Browser versions tested against:
    • Chrome
    • DOCTYPE tested against:

    • ____
    Description:
    • Just wanted to test the code provided in the Ext.data.Model example in the api docs.
    Steps to reproduce the problem:
    • copy and paste the code provided in the description of Ext.data.Model
    The result that was expected:
    • That the code works, not throwing errors!!!!!!!!!!!!
    The result that occurs instead:
    • Errors: TypeError: Cannot call method 'substring' of undefined
    Test Case:
    Code:
    Ext.define('User', {    extend: 'Ext.data.Model',
        fields: [
            {name: 'name',  type: 'string'},
            {name: 'age',   type: 'int'},
            {name: 'phone', type: 'string'},
            {name: 'alive', type: 'boolean', defaultValue: true}
        ],
    
    
        changeName: function() {
            var oldName = this.get('name'),
                newName = oldName + " The Barbarian";
    
    
            this.set('name', newName);
        }
    });
    
    
    
    
    var user = Ext.create('User', {
        name : 'Conan',
        age  : 24,
        phone: '555-555-5555'
    });

  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,255

    Default

    I can't reproduce this, I just went to:

    http://dev.sencha.com/deploy/ext-4.0...rray-grid.html

    Dropped this code into the console:

    Code:
    Ext.define('User', {
        extend: 'Ext.data.Model',
        fields: [{
            name: 'name',
            type: 'string'
        }, {
            name: 'age',
            type: 'int'
        }, {
            name: 'phone',
            type: 'string'
        }, {
            name: 'alive',
            type: 'boolean',
            defaultValue: true
        }],
        
        
        changeName: function(){
            var oldName = this.get('name'), 
                newName = oldName + " The Barbarian";
            
            
            this.set('name', newName);
        }
    });
    
    
    
    
    var user = Ext.create('User', {
        name: 'Conan',
        age: 24,
        phone: '555-555-5555'
    });
    user.changeName();
    console.log(user.get('name'));
    It prints the name as I would expect.
    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.

  3. #3
    Ext Premium Member halcwb's Avatar
    Join Date
    Mar 2010
    Location
    Rotterdam
    Posts
    411

    Default

    Same problem here, yesterday I tried the code in both FF 6.02 and in Chrome 14 and each time I run into the above errors. Today, they vanished. I am puzzled.

Posting Permissions

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