ExtJS 4:没有模型的网格/商店
我有几个网格,它们显示的数据并未真正映射到模型,例如统计数据、计数等。它们显示的值是由服务器根据当前登录的用户动态生成的,并且可能与任何数字相关服务器端模型。
针对这些情况设置 ExtJS 模型似乎很愚蠢。他们可能看起来像:
Ext.define('???', {
extend: 'Ext.data.Model',
fields: ['name', 'count']
});
这对我来说没有意义。我知道商店的 fields
属性仍然存在,但文档指出它只是为了向后兼容而存在,应该避免。另外,至少在兼容层运行的情况下,控制台会警告不要使用它。
那么针对这些情况的“正确”方法是什么?
I have several grids that display data that doesn't really map to a Model, e.g. statistics, counts, etc. The values they display are dynamically generated by the server based on the currently-logged in user, and could be related to any number of server-side models.
It seems silly to set up an ExtJS Model for these situations. They might look something like:
Ext.define('???', {
extend: 'Ext.data.Model',
fields: ['name', 'count']
});
It doesn't make sense to me. I know the fields
attribute of the store is still there, but the documentation states it is only really there for backwards compatibility and should be avoided. Plus, at least with the compatibility layer running, there's the console warning against using it.
So what is the "proper" approach for these situations?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有类似的问题。 Sencha 声称在这种情况下可以使用“fields”属性。
查看此线程:
http://www.sencha.com/forum/showthread.php?136362-Extjs-4-Dynamic-Model/page2" rel="noreferrer"> sencha.com/forum/showthread.php?136362-Extjs-4-Dynamic-Model/page2
在他们的论坛上。
Had a similar problem. Sencha claim that in such a case it's ok to use the 'fields' property.
Check out this thread:
http://www.sencha.com/forum/showthread.php?136362-Extjs-4-Dynamic-Model/page2
on their forum.