dedoz
14 Feb 2012, 1:03 PM
i have 2 models, they have a cross reference association ,
like saying user has many emails and email belongs to user.
and i get an error, loader says cant load '' (empty string) ;D
Example files
app/model/ModelType1.js
Ext.define('MUI.model.ModelType1', {
extend: 'Ext.data.Model',
requires : ['MUI.model.ModelType2'],
fields: ['id','name'],
hasMany :{ model: 'MUI.model.ModelType2', name:'model2'}
});
app/model/ModelType2.js
Ext.define('MUI.model.ModelType2', {
extend: 'Ext.data.Model',
requires : ['MUI.model.ModelType1'],
fields: ['id','name'],
belongsTo :{ model: 'MUI.model.ModelType1', name:'model1'}
});
a use file, just to isolate the problem
Ext.onReady(function() {
Ext.Loader.setConfig({enabled : true});
Ext.Loader.setPath('MUI','app');
Ext.require(['MUI.model.ModelType1']);
});
i just did a require, not even a create, just to check if the problem happens when loading my files.
triggers
Uncaught Error: The following classes are not declared even if their files have been loaded: ''. Please check the source code of their corresponding files for possible typos: '
so how can i do this ? its not posible ?
btw if i comment (//) the line from model2 that requires model1, theres no error, but then im forced to require model1 first to use model2,
like saying user has many emails and email belongs to user.
and i get an error, loader says cant load '' (empty string) ;D
Example files
app/model/ModelType1.js
Ext.define('MUI.model.ModelType1', {
extend: 'Ext.data.Model',
requires : ['MUI.model.ModelType2'],
fields: ['id','name'],
hasMany :{ model: 'MUI.model.ModelType2', name:'model2'}
});
app/model/ModelType2.js
Ext.define('MUI.model.ModelType2', {
extend: 'Ext.data.Model',
requires : ['MUI.model.ModelType1'],
fields: ['id','name'],
belongsTo :{ model: 'MUI.model.ModelType1', name:'model1'}
});
a use file, just to isolate the problem
Ext.onReady(function() {
Ext.Loader.setConfig({enabled : true});
Ext.Loader.setPath('MUI','app');
Ext.require(['MUI.model.ModelType1']);
});
i just did a require, not even a create, just to check if the problem happens when loading my files.
triggers
Uncaught Error: The following classes are not declared even if their files have been loaded: ''. Please check the source code of their corresponding files for possible typos: '
so how can i do this ? its not posible ?
btw if i comment (//) the line from model2 that requires model1, theres no error, but then im forced to require model1 first to use model2,