MVC - 为 UI 生成的额外数据存储在哪里?
我们正在构建一个 Silverlight 应用程序并使用 PureMVC,但技术和框架对于这个问题可能并不那么重要。
我们有一个包含网格的视图,并且该网格绑定到模型。但是,我们希望向用户显示额外的数据列,但这些数据是派生的而不是存储在模型中。
MVC 中处理这个问题的最佳位置在哪里?
任何帮助或建议将不胜感激!
非常感谢,
鲍比
We are building a Silverlight app and using PureMVC but the technology and framework probably aren't that important to this question.
We have a view that contains a grid and that grid is bound to a model. However, we have additional columns of data that we would like to display for the user but the data is derived and not stored in the model.
Where is the best place within MVC to handle this?
Any help or suggestions would greatly be appreciated!
Thanks a lot,
Bobby
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从“模式”方法来看,不要更改您的模型(除非您的模型已经被用作 ViewModel。在这种情况下实现特定的视图模型。视图模型应该具有视图逻辑(附加列、特定于模型布局的代码、等)普通模型不应该。
From a 'patterns' approach, do not change your model (unless your model already is purposed as a ViewModel. Implement a specific view model in this case. A view model should have view logic (additional columns, code specific to the model layout, etc) a plain model should not.
向模型对象添加附加列的属性,然后在其属性获取中连接它们背后的逻辑,并将它们作为附加列绑定到网格。
Add properties to your model object for the additional columns then wire up the logic behind them in their property gets and bind them to the grid as additional columns.