2

I am using dojox.grid.DataGrid for displaying Data inside a Grid . Currently there are 50 Records in the Databse so its displaying 50 Records in the Grid (Please see the UI here )

Is it possible to tell dojox.grid.DataGrid to display 10 Records per page . Means i want to show only 10 Records per page , if the user clicks on 2 Page under pagination it should display the next 10 Records .

Please tell me if this is possible ??

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>

This is my servlet Code :

public void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    response.setContentType("text/x-json;charset=UTF-8");
    response.setHeader("Cache-Control", "no-cache");

    System.out.print("MyservletSAA called");

    PrintWriter out = response.getWriter();

    List list = new ArrayList();

    for (int i = 0; i < 50; i++) {
        Employee emp = new Employee();
        emp.setDept("MyDept" + i);
        emp.setName("MYName" + i);

        list.add(emp);
    }

    JSONObject json = new JSONObject();
    json.put("items", list.toArray());

    response.getWriter().write(json.toString());

}
  • 2
    See this question for an example fiddle of a working grid: http://stackoverflow.com/questions/15269985/dojo-enhanced-grid-with-pagination-need-to-access-number-of-rows-in-the-page. – Jess Apr 15 '13 at 16:44

1 Answers1

0

Quite old post, but maybe it'll help someone:

http://dojotoolkit.org/reference-guide/1.9/quickstart/data/usingdatastores/pagination.html

ksSpring
  • 31
  • 3
  • Note that [link-only answers are discouraged](http://meta.stackoverflow.com/tags/link-only-answers/info), SO answers should be the end-point of a search for a solution (vs. yet another stopover of references, which tend to get stale over time). Please consider adding a stand-alone synopsis here, keeping the link as a reference. – kleopatra Sep 08 '13 at 20:44