Results 1 to 3 of 3

Thread: Hierarchical Data in JsonStore

  1. #1
    Ext JS Premium Member smcguire36's Avatar
    Join Date
    Sep 2007
    Location
    Manchester, Connecticut, USA
    Posts
    100
    Vote Rating
    2
      0  

    Question Hierarchical Data in JsonStore

    Can someone please show me an example of how to define the fields for a JsonStore where the data is hierarchical similar to the data that is used in the Advanced Template example?

    The Advanced Template example uses the following data definition:

    Code:
       var data = {
            name: 'Jack Slocum',
            company: 'Ext JS, LLC',
            address: '4 Red Bulls Drive',
            city: 'Cleveland',
            state: 'Ohio',
            zip: '44102',
            kids: [{
                name: 'Sara Grace',
                age:3
            },{
                name: 'Zachary',
                age:2
            },{
                name: 'John James',
                age:0
            }]
        };
    I understand how to define the fields for the top level items but how do I specify the fields for the name and age items for the kids?

    Any help would be appreciated as I cannot find any examples of the JsonStore with hierarchical data (ie. the kids array above). The Advanced Template example does not use a store.

    --Stewart

  2. #2
    Ext JS Premium Member smcguire36's Avatar
    Join Date
    Sep 2007
    Location
    Manchester, Connecticut, USA
    Posts
    100
    Vote Rating
    2
      0  

    Default

    Nevermind. I figured it out. You just have to define the root item (in this case, the "kids" item) and the XTemplate that uses the store picks up the children items automatically.

  3. #3
    Sencha Premium Member
    Join Date
    Nov 2012
    Location
    Bangalore
    Posts
    79
    Vote Rating
    1
      0  

    Default

    I have a form which will display

    hostname
    Model
    MAC
    IP
    version
    Clock

    But backend return data in hierarchal format like below

    {
    "data": {
    "base-stats": {
    "device": [
    {
    "count": "1",
    "mac": "00-11-22-22-A8-CA",
    "base": {
    "hostname": "Computer-22A8CA"
    },
    "system": {
    "version": "5.1-1711",
    "primary_ip": "192.168.3.1",
    "product-name": "RFSTWZ400",
    "clock": "2013-04-04 10:06:18 UTC"
    }
    }
    ]
    }
    }
    }


    How can i assign the hierarchy data into the form in flat manner.
    please suggest

Posting Permissions

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