You found a bug! We've classified it as EXTJS-3566 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Ext Premium Member halcwb's Avatar
    Join Date
    Mar 2010
    Location
    Rotterdam
    Posts
    379
    Vote Rating
    39
    halcwb has a spectacular aura about halcwb has a spectacular aura about

      0  

    Default Ext.Loader does not fetch associated models

    Ext.Loader does not fetch associated models


    REQUIRED INFORMATION


    Ext version tested:
    • Ext 4.0 rev 2.a

    Browser versions tested against:
    • FF5 (firebug 1.3.0.10 installed)

    Description: Ext.Loader does not resolve associations of model
    • When a model has an association with another model, this is not automatically resolved by Ext.Loader if the required model is not loaded yet.

    Steps to reproduce the problem:
    • Define model A
    • Define model B
    • Associate model A with B
    • Put model A and B in seperate files
    • Enable Ext.Loader
    • Create an instance of model A
    • Try to access model B

    The result that was expected:
    • The access method of model B should be defined, instead it is undefined.

    The result that occurs instead:
    • Association with model B is undefined

    Test Case: working code if in one file

    Code:
    Ext.define('GenForm.model.validation.ValidationRule', {
        extend: 'Ext.data.Model',
    
        fields: [
            { name: 'type', type: 'string'},
            { name: 'field', type: 'string'}
        ],
    
        associations: [
            { type: 'belongsTo', model: 'GenForm.model.user.Login', name: 'login'}
        ]
    
    });
    
    Ext.define('GenForm.model.user.Login',  {
        extend: 'Ext.data.Model',
    
        associations: [
            { type: 'hasMany', model: 'GenForm.model.validation.ValidationRule', name: 'validationRules'}
        ],
    
        fields: [
            { name: 'username' , type: 'string' },
            { name: 'password', type: 'string'}
        ],
    
    });
    
    var model = Ext.create('GenForm.model.user.Login');
    
    console.log(model.validationRules);


    HELPFUL INFORMATION


    Screenshot or Video:
    • attached

    See this URL for live test case: http://


    Debugging already done:
    • put in model A a requires: ['modelB']

    Possible fix:
    • not provided

    Additional CSS used:
    • only default ext-all.css
    • custom css (include details)

    Operating System:
    • Win 7

  2. #2
    Ext Premium Member halcwb's Avatar
    Join Date
    Mar 2010
    Location
    Rotterdam
    Posts
    379
    Vote Rating
    39
    halcwb has a spectacular aura about halcwb has a spectacular aura about

      0  

    Default


    The same problem applies to the asssociation of a store and a model. The code below will not work:

    PHP Code:
    Ext.define('GenForm.store.database.Database', {
        
    extend'Ext.data.Store',
        
    alias'widget.databasestore',
        
    storeId'databasestore',

        
    model'GenForm.model.database.Database',
        
    autoLoadtrue,

        
    proxy: {
            
    type'direct',
            
    directFnDatabase.GetDatabases
        
    }
    }); 
    However, if you add: requires: ['GenForm.model.database.Database'], the code works. (Given the fact that you use Ext.Loader and that you did not reference the store and model in a controller).

  3. #3
    Ext Premium Member halcwb's Avatar
    Join Date
    Mar 2010
    Location
    Rotterdam
    Posts
    379
    Vote Rating
    39
    halcwb has a spectacular aura about halcwb has a spectacular aura about

      0  

    Default Please provide update of this bugreport

    Please provide update of this bugreport


    As I took the trouble to report the above bug, I would like to know the status of this post.

  4. #4
    Sencha - Community Support Team edspencer's Avatar
    Join Date
    Jan 2009
    Location
    Palo Alto, California
    Posts
    1,939
    Vote Rating
    9
    edspencer is a jewel in the rough edspencer is a jewel in the rough edspencer is a jewel in the rough

      0  

    Default


    Hi halcwb, this was pushed into our bug tracker recently but it looks like whoever did so did not update this post. This issue is currently on the list for 4.1.x, and is related to a couple of other data issues that we're currently working through
    Ext JS Senior Software Architect
    Personal Blog: http://edspencer.net
    Twitter: http://twitter.com/edspencer
    Github: http://github.com/edspencer

  5. #5
    Ext Premium Member halcwb's Avatar
    Join Date
    Mar 2010
    Location
    Rotterdam
    Posts
    379
    Vote Rating
    39
    halcwb has a spectacular aura about halcwb has a spectacular aura about

      0  

    Default


    I very much appreciate your answer. Thanks!

Thread Participants: 1