1. #1
    Sencha Premium Member
    Join Date
    Jan 2010
    Location
    Vancouver, Canada
    Posts
    137
    Vote Rating
    29
    bogc will become famous soon enough bogc will become famous soon enough

      0  

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

    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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,548
    Vote Rating
    872
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      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 @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 User
    Join Date
    Sep 2007
    Posts
    101
    Vote Rating
    3
    tm8747a is on a distinguished road

      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.

Thread Participants: 2