1. #1
    Sencha User
    Join Date
    Feb 2013
    Posts
    10
    Answers
    1
    Vote Rating
    0
    RSSoll is on a distinguished road

      0  

    Default Unanswered: Nested model

    Unanswered: Nested model


    Hi!
    I am new to ExtJS and have few difficulties with it. I have a nested model from json, for example:
    Code:
    { "data": {
       "parentField": "value1",
       "children" : [{
          "childField": "value2",
       }, {
          "childField": "value3",
       }]
    }}
    I tried to use one page to edit the parent model with children model at the same time (having Documented Oriented Database children are written always inside parent), to change both a parent and children using one record. I'm implementing on one page form for parent, grid for parent.childrenStore (that was created inside the parent after it was created by reader) and connected grid with another form (as in: http://docs.sencha.com/ext-js/4-1/#!...form-grid.html). It is quite robust, and I still have many problems implementing it (like retrieving data changed in grid to save it back in record so that i can send this record via rest to database).

    My question is: is there an easy way to deal with nested models (cause my doesn't look like it)?

    I hope that I made my intention clear

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,522
    Answers
    3447
    Vote Rating
    814
    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

      0  

    Default


    So you want the form to deal with the parentField value and a grid for the children array?
    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
    Feb 2013
    Posts
    10
    Answers
    1
    Vote Rating
    0
    RSSoll is on a distinguished road

      0  

    Default


    First I thought about form with iterative repetition of fieldsets for children, but couldn't find anything like that in extjs. That's why I am using grid and one fieldset for children which is updated based on what is selected in grid. And I already implemented it in most part. I believe it is not the best method to deal with nested model because after every change in children form I have to update grid store and use a reader to update my model in the overall form (there is duplication of data). That's why I would like to hear some advice/opinions how other people deal with nested models (changing just one child is out of question, because it is not relational database, and to change a child I have to post all nested model anyway).

Thread Participants: 1

Tags for this Thread