PDA

View Full Version : What can replace Ext.Loader.load()



david.p
8 Mar 2011, 12:29 AM
I need to dynamically load a side javascript file and continue processing of my project only after it's loaded.
For this in ExtJS3, I used

Ext.Loader.load('../myJSfile.js', callback)

Now with ExtJS4, I didn't find what could replace this call..?
Any hint ?

BigWookie
28 Mar 2011, 2:10 AM
+1

Nickname
28 Mar 2011, 9:31 AM
Hi,
did not really test it, but could be the following snippet:



Ext.require([
'file.to.include'
], function() {
console.log('did it!');
});

PSB
30 Mar 2011, 8:44 AM
+1

PSB
4 Apr 2011, 1:21 AM
Ext Team, please help in this question. How load custom JS files that not includes a Ext class? Thanks!

steffenk
4 Apr 2011, 1:58 AM
using naming convention it's very easy to load dynamically files.

Example:

this.navigationPanel = Ext.create('view.navigationPanel', {...}

will load [appdir]/view/navigationPanel.js dynamically.

PSB
4 Apr 2011, 7:01 AM
this.Order_Form = Ext.create("JS/Order_Form", {
someProperty: 'something'
}, function () {
alert("OK");
});



[Ext.ClassManager] Cannot create an instance of unrecognized class name / alias: JS/Order_Form

steffenk
4 Apr 2011, 7:03 AM
read precise! Use dot as seperator, not slash.

PSB
5 Apr 2011, 2:02 AM
this.Order_Form = Ext.create("JS.Order_Form", {
someProperty: 'something'
}, function () {
alert("OK");
});


Order_Form.js


alert("HELLOWORLD!");

steffenk
5 Apr 2011, 2:18 AM
This logic is build for MVC pattern, so naming convention and directory structure has to match.
You have to use corresponding names to your namespace.

x3r0z
14 Nov 2011, 6:25 AM
I have some js files, but this no belong to the App, in ExtJS 3.x I load this files whit Ext.Loader.load, how I load this files in ExtJS 4.x, I can't use Ext.require because this files is not part to the app. Thanks