-
9 Jul 2011 12:06 PM #1
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
-
9 Jul 2011 12:10 PM #2
The same problem applies to the asssociation of a store and a model. The code below will not work:
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).PHP Code:Ext.define('GenForm.store.database.Database', {
extend: 'Ext.data.Store',
alias: 'widget.databasestore',
storeId: 'databasestore',
model: 'GenForm.model.database.Database',
autoLoad: true,
proxy: {
type: 'direct',
directFn: Database.GetDatabases
}
});
-
23 Jul 2011 12:18 AM #3
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.
-
24 Jul 2011 3:25 PM #4Sencha - Community Support Team
- Join Date
- Jan 2009
- Location
- Palo Alto, California
- Posts
- 1,941
- Vote Rating
- 6
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
-
26 Jul 2011 1:52 PM #5
I very much appreciate your answer. Thanks!
You found a bug! We've classified it as
EXTJSIV-3566
.
We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.


Reply With Quote