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 6226383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:01:16+00:00 2026-05-24T09:01:16+00:00

I’d like to have a dojo grid which connects to a server url which

  • 0

I’d like to have a dojo grid which connects to a server url which outputs the following json :
{identifier : “id”
items : [ { id: “1”, name: “John”, university : { name: “XXX”, address: “YYY” } }].

Basically I have a nested json. I would like to represent the university name and University address as separate columns in the grid.

I tried using the dojox.grid.DataGrid object and creating a gird layout, but do not know how to refer to the nested elments and university.name and university.address don’t seem to work.
I am using dojo 1.6.1.

Does anybody have any pointers?

This is the js code I use :

    dojo.require("dojox.grid.DataGrid");
    dojo.require("dojo.data.ItemFileReadStore");

    dojo.addOnLoad(function(){
    // our test data store for this example:
    var jsonStore = new dojo.data.ItemFileReadStore({
        url: '/MainDeployer/ajax/users/get.json'
    });

    var layoutUsers = [
       [{
               field: "name",
               name: "Name",
               width: 10
           },
           {
               field: "university.name",
               name: "University Name",
               width: 10
           },
           {
               field: "university.address",
               name: "University Address",
               width: 'auto'
           }]];

    // create a new grid:
    var grid = new dojox.grid.DataGrid({
        query: {},
        store: jsonStore,
        clientSort: true,
        rowSelector: '20px',
        structure: layoutUsers
    },
    document.createElement('div'));

    dojo.byId("usersTable").appendChild(grid.domNode);

    grid.startup();
});

Thanks,
Cristian

  • 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-05-24T09:01:19+00:00Added an answer on May 24, 2026 at 9:01 am

    What kind of store are you using? Have a look at the dojo.data.ItemFileReadStore documentation, there is an example with a situation like yours:
    http://dojotoolkit.org/reference-guide/dojo/data/ItemFileReadStore.html#item-structure

    This would help you fetching all the items with a single call to the method “fetch”. If for some reasons it doesn’t work due to the different json structure, you can continue using ItemFileReadStore , and create a function that loops over all the objects in your json and uses the loadItem method for adding items one by one in this way (it’s not beautiful but it works):

    var myData = {"items" : []};
    var myStore = new dojo.data.ItemFileWriteStore({data: myData});
    var myLayout = [{
        field: 'name',
        name: 'Name',
        width: '200px'
    },
    {
    field: 'universityName',
    name: 'University Name',
    width: '100px'
    },
    {
    field: 'universityAddress',
    name: 'University Address',
    width: '60px'
    }];
    var myGrid;
    
    dojo.addOnLoad(function(){
        myGrid = new dojox.grid.DataGrid({
            store: myStore,
            structure: myLayout
        }, document.createElement('div'));
        dojo.byId("myGridContainer").appendChild(myGrid.domNode); 
        myGrid.startup();
    
        dojo.xhrGet({
            url: myURL,
            handleAs: "json",
            headers: {
                "Content-Type": "application/json; charset=uft-8", 
                "Accept" : "application/json"
            },
            load: function(responseObject, ioArgs) {
                myList = responseObject;
                dojo.forEach(myList.items, function(element) {     
                    myStore.newItem({"name": element.name, 
                        "universityName": element.university.name,
                        "universityAddress": element.university.address});
                });
            })
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
I have an autohotkey script which looks up a word in a bilingual dictionary
I have an array which has BIG numbers and small numbers in it. I
I have a text area in my form which accepts all possible characters from
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I have two tables with like below codes: Table: Accounts id | username |
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text

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.