mansoor
mansoor

Reputation: 11

Changing Extjs 4 default MVC folder structure

I am writing an application that has both extjs and sencha touch version. my current folder structure is like

root
...extjs4application
......app
.........model
.........store
.........view
.........controller

...senchatouch2application
......app
.........model
.........store
.........view
.........controller

model and store are similar in both application so i need to organize my folder structure in such a way that both application could share single/common model and store folders. What could be the possible solution? Please help

Upvotes: 1

Views: 3005

Answers (1)

Eric
Eric

Reputation: 6995

Based on a cursory glance over the source for Ext.app.Application it looks like it's possible to change the paths without overriding anything.

The path to the app folder is controlled by the appFolder config which defaults to "app." You can change this as you see fit but it's not necessary to do so.

Also included in the application class is an undocumented config called paths which is an object containing simple (key, value) pairs. Example:

paths: {
    "Ext":    "/path/to/Ext",
    "Ext.ux": "/path/to/Ext/ux"
    // etc...
}

The Ext.app.Application constructor checks for the presence of the paths config and calls Ext.Loader#setPath for each entry. You can read more about Ext.Loader at Sencha Docs

I don't like including disclaimers with my answers, but in this case I feel I should: I haven't personally used this to create an application so I can't completely vouch for its correctness, but it should be a start. If this should fail, you may need to override or extend the library classes to suit your needs (probably either Ext.app.Application or Ext.Loader).

Upvotes: 1

Related Questions