PDA

View Full Version : Use separated .js file instead compiled .js



Victor23
7 Feb 2014, 3:59 AM
Hi,

I'm using ExtJS4 and it's work fine... with firefox. With Internet Explorer below version 9 (especially v8) there are some problems. IE developpment tool say :
Fr : Erreur d'exécution inconnue ------------ ext-all-dev.js, Ligne 11902 Caractère 25
Eng : Unknown Runtime Error ------------ ext-all-dev.js, line 11902 character 25

I want to put breakpoint before error but when I click on the error to access the offending line, IE crash... Certainly there are too many line in ext-all-dev.js (134731!)

So i want to load each JS file of ExtJS core instead of compiled file to workaround the problem. But I don't find how to...
I already tried to add all JS file in the head of my page with 150 lines like :


<script type="text/javascript" src="library/ext/src/[file.js]"></script>
But there were problems as "ext is not defined" or "describe is not defined"...

Please tell me how to load each JS file separately


Thanks a lot
Victor

burnnat
7 Feb 2014, 8:12 AM
You'll want to enable dynamic class loading for your application and use ext-dev.js rather than ext-dev-all.js. This blog post (http://www.bleext.com/blog/loading-classes-dynamically-with-extjs4/) has a good explanation of how to configure your project for dynamic loading using Ext.Loader (http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.Loader).

Victor23
11 Feb 2014, 6:09 AM
Thank you but it's not that im looking for. I need to load ALL ExtJS file, not my JS files to debbuge IE issues. I still tried your solution with


<script type="text/javascript" src="library/ext/ext-dev.js"></script>
<script>
Ext.Loader.setConfig({
enabled: true,
paths : {
Ext : "library/ext/src"
}
});
Ext.require("Ext.Ajax");
Ext.require("Ext.view.View");
Ext.require("Ext.grid.Panel");
Ext.require("Ext.picker.Date");
Ext.require("Ext.form.Basic");
</script>

But firebug say "Ext.Ajax is not defined" for the first Ajax request of my app.

I'm not sure that is the trick i need.

burnnat
11 Feb 2014, 6:17 AM
Seems like you're on the right track to me, the code you show looks correct. Is the code that makes your AJAX request wrapped in Ext.onReady() (http://docs.sencha.com/extjs/4.2.1/#!/api/Ext-method-onReady)? If you don't use onReady, your code will start to execute before the necessary classes have a chance to load, which would cause an error like you describe.

Victor23
11 Feb 2014, 6:30 AM
Thank you very much. It work great, I can debbug nicely! Thank for your reactivity