更改Extjs 4默认的MVC文件夹结构 [英] Changing Extjs 4 default MVC folder structure

查看:124
本文介绍了更改Extjs 4默认的MVC文件夹结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个具有extjs和sencha touch版本的应用程序。我当前的文件夹结构就像

  root 
... extjs4application
......应用程序
......... model
......... store
.........查看
.... .....控制器

... senchatouch2application
... app
.........模型
... ......存储
.........查看
.........控制器

模型和存储在两个应用程序中相似,所以我需要组织我的文件夹结构,使得这两个应用程序可以共享单个/通用模型和存储文件夹。可能的解决方案是什么?请帮助

解决方案

基于粗略的浏览源 Ext.app.Application 它似乎可以更改路径而不覆盖任何东西。



应用程序文件夹的路径由 appFolder config,默认为app。您可以根据需要更改此内容,但不需要这样做。



应用程序类中还包含一个未记录的配置,名为 / code>它是一个包含简单(键,值)对的对象。示例:

 路径:{
Ext:/ path / to / Ext,
Ext.ux:/ path / to / Ext / ux
// etc ...
}

Ext.app.Application 构造函数检查路径的存在为每个条目配置并调用 Ext.Loader#setPath 。您可以阅读更多关于 Ext.Loader



我不喜欢将免责声明包含在我的答案中,但在这种情况下,我觉得我应该:我没有亲自使用这个来创建一个应用程序,所以我不能完全保证它的正确性,但它应该是一个开始。如果这应该失败,您可能需要覆盖或扩展库类以满足您的需要(可能是 Ext.app.Application Ext.Loader )。


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

解决方案

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

这篇关于更改Extjs 4默认的MVC文件夹结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆