Ext JS 4 - 如何在视图内显示其他视图?
在 MVC 风格的 Ext JS 4 应用程序中,假设我有一个控制器/视图/存储/模型并且正确加载 - 例如,让我们说 这个示例是我的代码库。
我的应用程序加载一个带有网格(用户列表)的视图,然后当单击一行时,它会打开并使用表单编辑(用户)视图。
现在,我想添加要在该表单内显示的其他视图。
例如,我想在用户表单的字段下方显示“最近 10 次登录”(用户的活动记录列表)。我将为“ActivityLog”拥有一个单独的视图/控制器/模型/存储。因此,我需要创建 ActivityLog 列表视图/控制器并将其放置在我的用户视图中(它还将有自己的代码/逻辑来处理网格中这些记录的点击等)。
这是正确的方法吗?
用户控制器是否会加载 ActivityLog 的视图/控制器并以某种方式将其放入用户编辑视图中,或者我是否直接在加载它的用户编辑视图中拥有配置数据?
In an MVC style Ext JS 4 application, assuming I have a single controller/view/store/model and that loads up properly- for an example, let's say this example is my code base.
My application loads up a view with a grid (list of Users), then when a row is clicked it opens and edit (User) view with a form.
Now, I want to add additional views to be displayed inside that form.
For example, I want to show a 'last 10 logins' (a list of activity records for the user) below the fields in the User form. I will have a separate view/controller/model/store for 'ActivityLog'. So I need to create the ActivityLog List view/controller and place it inside my User view (it will also have it's own code/logic to handle clicks on those records in it's grid, etc.).
Is that the correct approach?
Would the User controller load the view/controller of ActivityLog and somehow place it in to the User edit view, or do I have config data directly inside the User edit view that loads it in ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好的。也许你可以使用这样的东西
// 导航控制器
// 用户控制器
// ActivityLog 控制器
// 另外你应该有树视图文件
// navigation.TabHost
// users.List
// Activitylog.List
导航控制器将创建小部件并插入他们到它的选项卡主机。
但是 ActivityLog 和用户控制器将操纵它们的视图。
Ok. Probably you can use something like this
// Navigation controller
// Users controller
// ActivityLog controller
// Also you should have tree view files
// navigation.TabHost
// users.List
// activitylog.List
Navigation controller will create widges and insert them to its tabhost.
But ActivityLog and Users Controllers will manipulate their views.
?是的,你可以这样做。
用户控制器可以使用另一个控制器的视图。在其他情况下,控制器可以侦听在另一个控制器中添加的视图。
首先,您应该在 app.js 中注册控制器,
然后控制器文件中描述的所有视图/存储/模型将自动加载。
您将能够随时随地操纵(添加/删除)视图。但是控制器将监听您明确指定的视图。
Yes, you can do this.
User controller can use view from another controller. In other case controller can listen to view which was added in the another controller.
First off all you should register controllers in app.js
After that all views/stores/models, which was described in the controllers files, will be loaded automatically.
You will have ability to manipulate (add/remove) views wherever you want. But controllers will be listening to the views that you definitely specified.