PDA

View Full Version : Need help with "ext.js" include...



neurodon
24 Jan 2012, 11:17 AM
Hello,

I have built an application that I'm working on top of Beta1, and I'm having an issue with including the "ext.js" file. The application works perfectly if I include ext-all.js, however when I change the index.html header to this:

<link rel="shortcut icon" type="image/ico" href="/assets/default/favicon.ico" />
<link rel="stylesheet" type="text/css" href="assets/core.css">
<script type="text/javascript" src="js/ext.js"></script>
<script type="text/javascript" src="/app-all.js"></script>
<script type="text/javascript" src="core.js"></script>

I get a bunch of these javascript errors on application load:
http://localhost/Core/view/app/layout/dashboard/Widget.js?_dc=1327432469576 404 (Not Found)
http://localhost/Core/view/module/marketing/Navigation.js?_dc=1327432469576 404 (Not Found)
http://localhost/Core/view/app/widget/Stream.js?_dc=1327432469576 404 (Not Found)
http://localhost/Core/view/app/widget/Chart.js?_dc=1327432469576 404 (Not Found)
http://localhost/Core/view/app/layout/Dashboard.js?_dc=1327432469576 404 (Not Found)



It's as if it reverted to trying to pull all of my js files from the development 'app' folder.

Any suggestions?

Thanks!

Brandon

mitchellsimoens
24 Jan 2012, 11:20 AM
You need to use the requires, stores, models all that stuff that tells Ext.Loader to require those classes. SDK Tools rely on these configs.

neurodon
24 Jan 2012, 12:25 PM
Is there a centralized place to include everything in the app.js file? My file currently looks like this:
----
Ext.Loader.setConfig({ enabled: true });
Ext.application({
name: 'Core',
paths: {
'Ext.ux': '/js/ux/'
},
controllers: [
'Header',
'Navigator'
],

models: [
'RandomDataModel',
'SimpsonsModel'
],

stores: [
'RandomDataStore',
'SimpsonsStore'
],


autoCreateViewport: true
});
----

I am playing around with the "requires" and "views" options right now...

Any hints?

mitchellsimoens
24 Jan 2012, 12:32 PM
You should do it in the class that is going to use it. Controllers need to be added to the application. Stores/Models can be application or controllers. In your views, if they require a widget or another class, put it in the requires/uses property. Basically, it's ok to be verbose, the classes will only be included once.