Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7906125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T10:47:09+00:00 2026-06-03T10:47:09+00:00

I have Json data that has children elements. I need to bind the store

  • 0

I have Json data that has children elements. I need to bind the store to an editable grid and have the edits populated to the store.
The data tree does get populated into the ItemFileWriteStore. The datagrid displays only the parent data and none of the children data.

SAMPLE.TXT

    {
    "items": [
        {
            "profileId": "1",
            "profileName": "ABC",
            "profileType": "EmailProfile",
            "profilePreferences": [
                {
                    "profilePreferenceId": "1",
                    "displayText": "Bob",
                    "address": "primary@some.com"
                },
                {
                    "profilePreferenceId": "2",
                    "displayText": "Sally",
                    "address": "secondary@some.com"
                },
                {
                    "profilePreferenceId": "3",
                    "displayText": "Joe",
                    "address": "alternate@some.com"
                }
            ]
        }
    ]
}

javascript

var sampleLayout = [
  [
  { field: 'profileName', name: 'profileName', width: '100px' },
  { field: 'profilePreferences.displayText', name: 'displayText', width: '100px' },
  { field: 'profilePreferences.address', name: 'address', width: '100px' }      
  ]];


function populateGrid() {
    var url = "sample.txt"; //Will be replaced with endpoint URL

    dojo.xhrGet({
        handleAs: 'json',
        url: url,
        error: function (e) {
            alert("Error: " + e.message);
        },
        load: showJsonData
    });
}


function showJsonData(response, ioArgs) {
    var profileStore = new dojo.data.ItemFileWriteStore({
        data: {
            items: response.items
        }
    });

    var sampleGrid = dijit.byId("sampleGrid");
    sampleGrid.store = profileStore;
    sampleGrid.startup();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T10:47:15+00:00Added an answer on June 3, 2026 at 10:47 am

    you need to be using dojox.grid.TreeGrid or ‘fake’ the JSON to present every even row with a blank profileName. Two samples follows, one for TreeGrid another on DataGrid – not tested in working environment though.

    Given Hierachial JSON:

    {
      identifier: 'id' // a good custom to make an id pr item, note spaces and odd chars are invalid
    
          items: [{
             id: '1',
             profileName: 'Admin',
             profilePreferences: [
               { id: '1_1', displayText: 'John Doe', address: 'Big Apple' }
               { id: '1_2', displayText: 'Jane Doe', address: 'Hollywood' }
             ]
    
          }, {
             id: '2',
             profileName: 'Visitor',
             profilePreferences: [
               { id: '2_1', displayText: 'Foo', address: 'Texas' }
               { id: '2_2', displayText: 'Bar', address: 'Indiana' }
             ]
    
          }]
        }
    

    TreeGrid Structure:

    {
        cells: [
          [
            { field: "profileName", name: "profileName", width: "100px" },
            { field: "profilePreferences",
              children: [
                { field: "displayText" name: "displayText", width: "100px" },
                { field: "address" name: "address", width: "100px" }
              ]
          ]
        ]
      }
    

    reference: dojo docs

    Given flattened ‘fake-children’ JSON:

    {
      identifier: 'id' // a good custom to make an id pr item, note spaces and odd chars are invalid
    
          items: [{
             id: '1',
             profileName: 'Admin', preferenceText: '', preferenceAddr: ''
         }, {
            id: '2', 
            profileName: '',      preferenceText: 'John', preferenceAddr: 'NY'
         }, {
             id: '3',
             profileName: 'Visitor', preferenceText: '', preferenceAddr: ''
         }, {
    
             id: '4',         // Not with '.' dot seperator like so
             profileName: '',    preference.Text: 'Jane Doe', preference.Addr: 'Hollywood'
         } ]
    

    DataGrid structure:

    [[
      {'name': 'Profilename', 'field': 'profileName', 'width': '100px'},
      {'name': 'User name', 'field': 'preferenceText', 'width': '100px'},
      {'name': 'Address', 'field': 'preferenceAddr', 'width': '200px'}
    ]]
    

    reference dojo docs

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a var that has some JSON data: A = <<{\job\: {\id\: \1\}}>>.
I have some data that I have to serialize to JSON. I'm using JSON.NET.
I have a controller that is called with AJAX (sends JSON data), so I
I have a rake task that pulls and parses JSON data over an SSL
I have 2 activities. The first activity is an activity that parses JSON data
I have an application that will return JSON-P data, and I have been communicating
I have a JSON that contains the following: {p1:{debris:{titanium:0,silicum:0}},p2:{debris:{titanium:0,silicum:0}}... I declare the data using
I have a small data conversion application that converts xml into a json then
I have a web service that queries data from this json file, but I
I have a php script that outputs json data. For the purposes of testing,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.