2011-07-09 7 views
2

グリッド内のデータを表示するためにdojox.grid.DataGridを使用しています。現在、50レコードがデータベースにあり、グリッド内に50個のレコードが表示されます(ここのUIを参照してください)。dojox.grid.DataGridでページ番号を設定する方法

dojox.grid.DataGridにページあたり10レコードを表示することはできますか? ページあたり10レコードしか表示しないことを意味します。ユーザーが2ページのページングをクリックすると、次の10レコードが表示されます。

これが可能かどうか教えてください。

これは私のJSPページです:

<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> 

これは私のサーブレットのコードです:

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

作業中のグリッドの例題については、この質問を参照してください:http://stackoverflow.com/questions/15269985/dojo-enhanced-grid-with-pagination-need-to-access-number-ofrows-in-the -ページ。 – Jess

答えて

0

かなり古いポスト、多分それは誰かを助けます:

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

+0

[リンクのみの回答はお勧めできません](http://meta.stackoverflow.com/tags/link-only-answers/info)、SOの回答は解決策の検索の終点になるはずです(対時間の経過とともに古くなる傾向がある参照の途中降機)。リンクを参考にして、ここにスタンドアロンの概要を追加することを検討してください。 – kleopatra

関連する問題