Changing Extjs 4 default MVC folder structure

我的梦境 提交于 2020-02-05 03:48:12

问题


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


回答1:


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).



来源:https://stackoverflow.com/questions/8601094/changing-extjs-4-default-mvc-folder-structure

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!