dedoz
10 Feb 2012, 12:15 PM
without Ext.require first, to check doesnt throw any error/warning
// works ------------------------------------------------
Ext.define('MUI.model.per', {
extend: 'Ext.data.Model',
fields: ['id','name']
});
Ext.create('MUI.model.per');
using sync require
// sync require : doesnt work ------------------------------------------------
Ext.Loader.setPath('MUI','app');
Ext.syncRequire(['MUI.model.per']);
per = Ext.create('MUI.model.per');
// says : Ext.Loader is not enabled, so dependencies cannot be resolved dynamically......
// Missing MUI.model.per
// But i dont need enable dinamyc loading, im loading the class first.
using async require
// async require : doesnt work ------------------------------------------------
// using callback function when finish loading classes
Ext.Loader.setPath('MUI','app');
Ext.require(['MUI.model.per'],
function() {
per = Ext.create('MUI.model.per');
// says : Ext.Loader is not enabled, so dependencies cannot be resolved dynamically.....
// Missing MUI.model.per
// same , i dont need enable dinamyc loading, im loading the class first.
}
);
So how can i use Ext.require?
( test using Ext 4.07 - 4.1 pr1 - 4.1 beta 1 in firefox 10, chrome 17 )
// works ------------------------------------------------
Ext.define('MUI.model.per', {
extend: 'Ext.data.Model',
fields: ['id','name']
});
Ext.create('MUI.model.per');
using sync require
// sync require : doesnt work ------------------------------------------------
Ext.Loader.setPath('MUI','app');
Ext.syncRequire(['MUI.model.per']);
per = Ext.create('MUI.model.per');
// says : Ext.Loader is not enabled, so dependencies cannot be resolved dynamically......
// Missing MUI.model.per
// But i dont need enable dinamyc loading, im loading the class first.
using async require
// async require : doesnt work ------------------------------------------------
// using callback function when finish loading classes
Ext.Loader.setPath('MUI','app');
Ext.require(['MUI.model.per'],
function() {
per = Ext.create('MUI.model.per');
// says : Ext.Loader is not enabled, so dependencies cannot be resolved dynamically.....
// Missing MUI.model.per
// same , i dont need enable dinamyc loading, im loading the class first.
}
);
So how can i use Ext.require?
( test using Ext 4.07 - 4.1 pr1 - 4.1 beta 1 in firefox 10, chrome 17 )