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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:09:59+00:00 2026-05-23T14:09:59+00:00

I am using DOJO ItemFileReadStore with dojox.grid.DataGrid to show Data Inside a Grid Please

  • 0

I am using DOJO ItemFileReadStore with dojox.grid.DataGrid to show Data Inside a Grid

Please see the Image here
http://imageshare.web.id/viewer.php?file=kdfvrkmn6k7xafmi4jdy.jpg

EMployee.Java

public class Employee {

    String name;
    String dept;
// Setters and Getters
}

This is My Servlet

response.setContentType("text/x-json;charset=UTF-8");
response.setHeader("Cache-Control", "no-cache");
PrintWriter out = response.getWriter();
List list = new ArrayList();
Employee emp1 = new Employee();
Employee emp2 = new Employee();
emp1.setDept("CSE");
emp1.setName("Vamsi");
emp2.setDept("EEE");
emp2.setName("Raju");
list.add(emp1);
list.add(emp2);
List jsonresponse = new ArrayList();
for (int i = 0; i < list.size(); i++) {
JSONObject nextObject = new JSONObject();
nextObject.put("name", list.get(i));
jsonresponse.add(nextObject);
}
JSONObject json = new JSONObject();
json.put("label", "name");
json.put("items", jsonresponse.toArray());
response.getWriter().write(json.toString());
}

This is MY JSP Page

<body class=" claro ">
<span dojoType="dojo.data.ItemFileReadStore" jsId="store1" url="http://localhost:8080/Man/MyServlet2"></span>

<table dojoType="dojox.grid.DataGrid" store="store1" 
   style="width: 100%; height: 500px;">
    <thead>
        <tr>
            <th width="150px" field="name">Name</th>
            <th width="150px" field="dept">Dept</th>
                    </tr>
    </thead>
</table>

Please see the Image here
http://imageshare.web.id/viewer.php?file=kdfvrkmn6k7xafmi4jdy.jpg

Please help , Thank you .

  • 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-23T14:09:59+00:00Added an answer on May 23, 2026 at 2:09 pm

    +1 for posting the server output (firebug screenshot) in your question. This makes a lot easier for people to help you – for example I can easily see that the data format is still not quite right. You are getting better at both dojo and stackoverflow, it seems!

    Remember that the ItemFileReadStore expects the data to be in a particular format. Your servlet is producing:

    {label: "name", items: [
        {name: {dept: "CSE", name: "Vansi"}}, 
        {name: {dept: "ABC", name: "Abcd"}}
    ]}
    

    You see you are telling the store that each item’s “name” is an object with some properties (“dept” and “name”). This is why the grid shows object Object in the name column. It should be:

    {label: "name", items: [
        {dept: "CSE", name: "Vansi"}, 
        {dept: "ABC", name: "Abcd"}
    ]}
    

    I’m not very good with java, but I believe only a small change in your servlet is required:

    // The for loop that adds employees to jsonresponse.
    for (int i = 0; i < list.size(); i++) 
    {
        // Instead of adding the 
        Emloyee e = (Employee)list.get(i);
        JSONObject nextObject = new JSONObject();
        nextObject.put("name", e.getName());
        nextObject.put("dept", e.getDept());
        jsonresponse.add(nextObject);
    }
    

    In fact, it’s possible that you can just do json.put("items", list.toArray()); instead of adding each employee to jsonresponse.

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

Sidebar

Related Questions

I am using DOJO for data grid presentation <div id=grid_log dojoType=dojox.grid.DataGrid store=log structure=window.layout_log queryOptions={deep:true}
I'm trying to create a DOJO DataGrid populated using a dojo.data.ItemFileReadStore with very simple
I am using dojo datagrid to display my data. When the end user edit
I have a web page displaying data using dojo datagrid. Sometimes, users need to
I'm using the following html to load dojo from Google's hosting. <script src=http://www.google.com/jsapi></script> <script
I'm loading data using dojo.io.script.get. Size of each request can be big and I
I am a dojo newbie so please forgive my ignorance. I have a dojox.mobile.EdgeToEdgeDataList
I'm using Dojo 1.5 to create a dijit.form.Select with some data from a datastore.
i'm using Dojo 1.6 and trying to update an Html-Store with new data using
I'm using a datagrid/table construct and the data is appearing over the column headers

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.