25 Feb 2013 10:42 AM #1
Should a parent row in a HasMany relationship marked as dirty if its children change?
Currently, it seems that if I have master-detail relationship, for instance, an Order has many LineItems, if the line items are changed (i.e. deleted, added, modified) the Order row is not marked as dirty automatically.
In my example, if I provide the UI to edit an Order (whose data is represented as a model with relationships), when the user clicks the Save button I want all the changes in the store (including changes in the children) to be sent to the server so I can persist these changes in the database. However, orderStore.getModifiedRecords() returns  even though the children have been modified.
If I were to keep track of Order and Line Items using separate stores (ExtJs 3.x way) this would work because I can send the changes to the orderStore and the lineItemsStore together.
27 Feb 2013 8:10 AM #2
- Join Date
- Mar 2007
- Gainesville, FL
- Vote Rating
The reason it's not is the association is just to split out data. There is not event bubbling from child associated data to the main data.Mitchell Simoens @LikelyMitch
Sencha Inc, Senior Software Engineer
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services email@example.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!
When posting code, please use BBCode's CODE tags.
6 Jun 2013 10:14 AM #3
I just started working with associations and ran into this scenario. I personally think that ideally it should mark the parent as dirty too.