查看 ExtJS 4 MVC 中的单元
在 ExtJS 4 MVC 单网页应用程序中我们如何识别视图? 将每个 Ext.Window 视为一个视图单元是一个好习惯吗? (app/view 文件夹中每个窗口一个文件夹) 什么是最佳实践?
How in an ExtJS 4 MVC single web page application we can identify Views?
Is it a good practice to consider each Ext.Window as a View unit? (one folder for each Window in app/view folder)
What is best practice?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为每个窗口使用单个文件夹可能是一场噩梦。
这个概念不是针对每个窗口,而是针对每个实体(或模型)。
关键是为每个模型的视图建立一个文件夹。
例如,您的应用程序中有 3 个实体(模型),即“客户”、“发票”、“付款”,您在视图主文件夹中应该有 3 个子文件夹,每个模型一个。每个文件夹内都有用于每个模型的 CRUD 的视图:列表和编辑。如果您对同一模型有其他视图,则应将其放入各自的文件夹中(查询、图表等)。
我一直在工资单应用程序中工作,我的规则是像在 Java 中一样使用子文件夹作为包。我将相关视图分组在同一个“包”中,即使不仅仅针对一种模型。例如,我有一个用于所有“目录”模型(部门、工作等)的文件夹,另一个用于工资单处理等。
ExtJS 的 MVC 与 Ruby on Rails 非常相似。
问候。
Using single folder for each Window could be a nigthmare.
The concept is not for each window but for each entity (or model).
Having a folder for each model's views is the point.
For example, you have 3 entitites (models) in your application, sat Customer, Invoice, Payment your should have 3 subfolders in view main folder, one for each model. Inside each folder are the views used for CRUD for each model: List and Edit. If you have another views for the same model you should put in their respective folder (inquiry, charts, etc.).
I been working in a payroll application and my rule is use soubfolders as packages as I do in Java. I group related views in the same "package" even if is not for only one model. For example, I have a folder for all "catalog" models (depts, jobs, etc.), another for payroll processing and so.
The MVC of ExtJS is very similar to Ruby on Rails.
Regards.
您应该在开始应用程序之前阅读这些内容
http://www .sencha.com/forum/showthread.php?131671-高级-MVC-最佳实践
http://www.sencha.com/learn /在-ext-js-4-part-2中构建您的应用程序
You should read these before starting your application
http://www.sencha.com/forum/showthread.php?131671-Advanced-MVC-Best-Practices
http://www.sencha.com/learn/architecting-your-app-in-ext-js-4-part-2