ExtJS 4 关联和 store.save()
我正在使用 ExtJS 4,并且有一个定义了关联 hasMany 的模型。
ModelA -> hasMany -> ModelB
我使用 GridA 显示来自 ModelA 的数据。单击 GridA 中的记录时,我使用 rowSelect 事件创建 GridB,该 GridB 使用 ModelA.ModelB() 作为存储。
一切都很顺利,直到我更改了 ModelB 中的记录。记录确实在层次结构中更新,但是当我执行 StoreA.save() 时,没有任何更改发送回服务器。它没有注意到关联的变化。如何在不破坏架构的情况下保存这些数据?
我希望模型能够按照加载的方式进行保存。
此外,当我更改 ModelA 中的记录时,它会仅作为 ModelA 而不是作为 ModelA->ModelB 发回,即使该记录具有 ModelB 数据也是如此。
谢谢
I am using ExtJS 4, and have a model with an association hasMany defined.
ModelA -> hasMany -> ModelB
I use GridA to show the data from ModelA. On clicking a record in GridA, I use a rowSelect event to create GridB which use ModelA.ModelB() as a store.
It all goes well until I change a record in ModelB. The record does get updated in the hierarchy, but when I execute StoreA.save(), no change is sent back to the server. It does not notice the changes in associations. How do I save this data, without hacking the architecture?
I am expecting the Model to be able to save, exactly the way it loads.
Also when I change a record in ModelA, it gets sent back as only ModelA and not as ModelA->ModelB, even when that record has ModelB data.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,我认为整个模型层次结构尚未完全发挥作用,达到您期望的水平。您可以假设只有本文档提到的内容才有效: http://docs.sencha.com/ext-js/4-0/#!/api/Ext.data.Model
Yeah I don't think this whole model hierarchy is fully functional yet to the level that you expected. You can assume that only the things that this Doc mentioned work: http://docs.sencha.com/ext-js/4-0/#!/api/Ext.data.Model
模型关系还没有得到很好的实现,ExtJS 4.1 除了修复了一些重要的错误之外,也没有对实现进行任何改进。要了解更多信息,请查看我的博客 http://blog.neolocus .com/2011/12/extjs-4-and-model-associations/
Model relations are not well implemented yet, and ExtJS 4.1 is not making any improvements on the implementation either, other than a few important bug fixes. To learn more check my blog at http://blog.neolocus.com/2011/12/extjs-4-and-model-associations/