PDA

View Full Version : How to change MVC "app" folder structure



sreenatht
22 Mar 2012, 4:59 AM
Shall we move the "app" folder in the extjs MVC Application to different folder? I tried it by referring the below link but it is not working. Please help


http://stackoverflow.com/questions/8879231/relative-paths-using-extjs-4 (http://stackoverflow.com/questions/8879231/relative-paths-using-extjs-4)

Thanks,
Sreenath

mitchellsimoens
22 Mar 2012, 10:35 AM
If you want to change the app folder name or location then you can use the appFolder config. If you want to change the structure under the app folder like controller and model this actually just depends on the class name.

sreenatht
22 Mar 2012, 10:46 AM
Yes I want to change the location of "app" folder . from root directory to some folder say "ExtJsApp"
like below

MyProject
--ExtJsApp
---Controller
----Model
----store
----View


I have tried like in the link i have added but it was not coming and showing an object reference null error. Please tell me if have nay other way.

Thanks,
sreenath

mitchellsimoens
22 Mar 2012, 10:52 AM
Ext.application({
name : 'MyApp',
appFolder : 'ExtJsApp',
...
});

The appFolder is used to create a path for your classes so that MyApp namespace resolves to the path in appFolder

sreenatht
22 Mar 2012, 11:00 AM
sorry..I will be like following
MyProject
--ExtJsApp
--App
---Controller
----Model
----store
----View


I have tried giving like below but it is showing object reference null error


Ext.application({
name: 'MyProject',
appFolder: '/ExtJsApp/app'
...
...

mitchellsimoens
22 Mar 2012, 11:13 AM
Is it because of the '/' at the beginning? That will make it go to the root of your web server URL

stewardsencha
22 Mar 2012, 12:56 PM
Heads up. You may be playing with fire.

One. A different structure will cost you time and effort when you need to share code to get help.

Two. The appFolder property is also used when creating the jsb3.
So take your baby app all the way through to deploy to uncover all the landmines.

Three. The paths config in the loader also needs to be set to the same value. Depending on maybe.

Four. Seems to me that at some point in the guts of extjs, the framework stops paying any attention to anything you configured, and parses the url, deciding on a document root all by itself. Where and how I am unclear. I am not yet able to trace/decipher the framework code.

Support ticket coming up. Here lies madness !

mitchellsimoens
22 Mar 2012, 1:15 PM
One of the first things Ext.app.Application does is


Ext.Loader.setPath(this.name, this.appFolder);

Ext.Loader should keep track of it no problems. If you are loading application files before Ext.application then you will of course then need to set a path before but at this point you haven't had the need for that.