0
votes

We have developed an application using Extjs 4.2 following MVC pattern. We have project folder setup as follwing:

WebContent
--> app
-->controller
-->model
-->store
-->view
app.html
app.js

In app.js we have defined all models, controllers, stores under Ext.application. Like:

Ext.application({
name: 'MyProject',
autoCreateViewport: true,
models: [
'Model1',    
'Model2'
],
stores: [
'store1',
'store2'
]

(views and controllers similarly)

This all works good for us. Now we need to concatenate all these models, stores, controllers, views into one app-all.js and use it in our app.html. I have read many posts on net on how to do that with Sencha cmd tool, but none of them was application to me as we have a restriction to install cmd tool and we need to generate concatenated and minified file on build time with Maven. I found out a solution that by using JSBuilder2, I can get a concatenated + minified app.js.

Problem is now when I use this minified file, all individual js files are still being downloaded. As if I delete individual js files, I get 404 error and application fails to load.

I suppose that is because of way we have defined models, views, controllers in our app.js; they are still looking for js class files in respective folders.

Please share if you have any solution to this.

1

1 Answers

1
votes

You can disable the dynamic loader using the enabled property of Ext.Loader (http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.Loader-cfg-enabled):

Ext.Loader.setConfig({ enabled: false })

You must place this code after including the framework files, but before your application files.

This should prevent Ext JS from trying to download files. You need to make sure all framework and application classes that you use are included on the page.