Results 1 to 3 of 3

Thread: Should a parent row in a HasMany relationship marked as dirty if its children change?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha Premium Member
    Join Date
    Jan 2010
    Location
    Vancouver, Canada
    Posts
    157
    Vote Rating
    69
      0  

    Default 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.

    Shouldn't it?

    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.

    Thanks

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,422
    Vote Rating
    1271
      1  

    Default

    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
    ________________
    Learn BBCode and use it!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    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 services@sencha.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.

  3. #3
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    136
    Vote Rating
    6
      1  

    Default

    I just started working with associations and ran into this scenario. I personally think that ideally it should mark the parent as dirty too.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •