PDA

View Full Version : Deploying MVC App



the_skua
17 Feb 2012, 8:40 AM
I'm using Sencha Tools in attempting to deploy my application to the web. The problem is that the application is still loading libraries from the src folder of extjs. Is there a way to code so that these get built in? I feel like I'm doing something wrong.

Here's the head of my app.js file:


Ext.Loader.setConfig({
enabled: true
});



Ext.application({ name: 'RiskMap',
appFolder: 'app',
layout: 'ux.center',

controllers: ["OpenLayersMap", "Models", "Forecast", "Legend"],
stores: ['StateCenters'],

launch: function() {

Do I need a Ext. require list? If I add this with some of the files, then the app doesn't load. Also, it's not including my classes from the appFolder. Help?

mitchellsimoens
17 Feb 2012, 8:46 AM
What classes are being dynamically loaded? Each of your application classes needs to have every class it requires in the requires config. Int he case of the controller and application, you can use the stores, views, etc.

Also, when you do the build, you should be using ext-debug.js, not ext-all-debug.js

the_skua
17 Feb 2012, 8:48 AM
I am using ext-debug.js.

So let me get this right...for the Application and each Controller, I need to set the requires config to contain each class declared within? By dynamic, what do you mean? Not declared by xtype?

Do you have an example?

mitchellsimoens
17 Feb 2012, 8:54 AM
No! For application and controllers you can use the separate controllers, stores etc. For your classes that are in there and for views and stores you should use requires. All the classes that are still being loaded, this is because you haven't required it or you haven't switch the script tag to load app.js to app-all.js

the_skua
17 Feb 2012, 9:10 AM
Does anyone have an example...I'm still really confused about where and how often I need to use requires: [].

the_skua
17 Feb 2012, 9:32 AM
So here's an example of what's not working for me. I use Ext.data.JsonP in one of my controllers functions. Here's the function:


retrieveStations: function() { //will end up wanting to config this
var j = Ext.data.JsonP.request({
url: 'http://XXXXX/proxy/wfs.ashx?request=GetFeature&typename=bms:users_loc_arch&request=GetMap&version=1.1.1&layers=&outputformat=json&maxfeatures=20',
//url: 'stations.txt',
callbackKey: 'this.parseResponse'
});
}

Where would I put the
requires: ['Ext.data.JsonP'] config so that Ext.data.JsonP got built into my app-all.js instead of being dynamically loaded from src? I've tried the controller, the view, and the app and everytime, it's loading it dynamically from src and it's not being include in the build.

mitchellsimoens
17 Feb 2012, 9:35 AM
There should be no reason why it isn't included as long as you switch from using app.js to app-all.js

the_skua
17 Feb 2012, 9:40 AM
Definitely have switched. It's not in jsb3 file either. Okay, I managed to get it added by putting:


Ext.require('Ext.data.JsonP'); before my Ext.application declaration.

Is there a way to get my appFolder classes built in too?