1. #1
    Sencha User
    Join Date
    Mar 2013
    Posts
    5
    Vote Rating
    0
    Luixo is on a distinguished road

      0  

    Default Nested objects in Ext.data.Model

    Nested objects in Ext.data.Model


    Hello,

    I made my own Ext.data.Model extension class to manage data in store (and after that, in grid). I recieve data from my server in JSON format and it is somelike complex, e.g.:

    { "name": "john", "id": "d781344c", "memory": { "unit": "Kb", "size": 524288 }, "os": { "type": { "arch": "x86_64", "machine": "pc-0.15", }, },
    }


    It is no problem to access and synchronize after change with 'name' or 'id' fields, but nested fields like memory.size cannot be synchronized. I made mapping for such fields, like

    {
    name: 'size',
    mapping: 'memory.size',
    }


    and mentioned in writer config of my store that

    {
    nameProperty: 'mapping',
    }


    but at synchronizing the JSON looks like:

    {"id":"d781344c","os.type.arch":"x86_64","memory.size":524289,"id":null}

    So the question is how to make nested data in model object for sending proper nested JSON requests.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,399
    Vote Rating
    849
    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


    What Ext JS 4.x.x version are you using? Thought I saw this was fixed.
    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
    Mar 2013
    Posts
    5
    Vote Rating
    0
    Luixo is on a distinguished road

      0  

    Default


    I use Ext JS 4.1.1

Thread Participants: 1