ExtJS 4 associations and store.save()

ⅰ亾dé卋堺 提交于 2019-12-10 15:42:56

问题


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


回答1:


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




回答2:


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/



来源:https://stackoverflow.com/questions/8601671/extjs-4-associations-and-store-save

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!