Results 1 to 2 of 2

Thread: [4.2.1] TypeError: Cannot call method 'hasId' of undefined

    Looks like we cannot reproduce this. Please provide another test case to reproduce this issue.
  1. #1
    Sencha Premium Member
    Join Date
    Sep 2010
    Posts
    100

    Default [4.2.1] TypeError: Cannot call method 'hasId' of undefined

    REQUIRED INFORMATION

    Ext version tested:

    • Ext 4.2.1
    Browser versions tested against:
    • Chrome
    • FF
    Description:
    • Model methods are called on a null value.
    Steps to reproduce the problem:


      • Create a model with an association that doesn't have any associated data. Call the associated getter.
      Sample code:
    Code:
    Ext.define('Address', {extend: 'Ext.data.Model',
        fields: [
            { name: 'id',          type: 'int' },
            { name: 'number', type: 'string' },
            { name: 'street', type: 'string' },
            { name: 'city', type: 'string' },
            { name: 'zip', type: 'string' }
        ],
    
    
        proxy: 'memory'
    });
    
    
    Ext.define('Person', {
        extend: 'Ext.data.Model',
        fields: [
            { name: 'id',   type: 'int' },
            { name: 'name', type: 'string' },
            { name: 'address_id', type: 'int'}
        ],
        // we can use the hasOne shortcut on the model to create a hasOne association
        associations: [{ type: 'hasOne', model: 'Address' }],
    
    
        proxy: 'memory'
    });
    
    
    new Person().getAddress();

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985

    Default

    Thanks for the report! I have opened a bug in our bug tracker.

Posting Permissions

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