index.jsp
上传用户:shjgzm
上传日期:2017-08-31
资源大小:2757k
文件大小:3k
源码类别:

Ajax

开发平台:

Java

  1. <%@ page contentType="text/html; charset=UTF-8"%>
  2. <%@ page language="java"%>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  4. <html>
  5. <head>
  6. <meta http-equiv="Content-type" content="text/html; charset=utf-8">
  7. <title>大量数据动态浏览查询</title>
  8. <style>
  9. /* 固定表格样式 */
  10. .fixedTable {
  11.    table-layout:fixed;
  12. }
  13. /* 单元格样式 */
  14. td.cell {
  15.     padding:2px 0px 2px 3px;
  16.     margin:0px;
  17.     border-bottom:1px solid #B8B8B8;
  18.     border-right:1px solid #B8B8B8;
  19.     height:22px;
  20.     overflow:hidden;
  21.     font-size:12px;
  22.     font-family:Arial;
  23.     line-height:12px;
  24. }
  25. /* 列头样式 */
  26. .first {
  27.    border-left:1px solid #B8B8B8;
  28. }
  29. /* 表头样式 */
  30. .tableCellHeader {
  31.    padding:2px 0px 2px 3px;
  32.    text-align:left;
  33.    font-size:12px;
  34.    border-top:1px solid #B8B8B8;
  35.    border-right:1px solid #B8B8B8;
  36.    background-color:#003366;
  37.    color:#FFF;
  38.    font-family:Arail;
  39. }
  40. </style>
  41. <script type="text/javascript" src="prototype.js"></script>
  42. <script type="text/javascript" src="rico.js"></script>
  43. <script type="text/javascript">
  44. function init() {
  45.     //设置预取参数为true,数据滚动响应函数为updateTip
  46.     var opts = {
  47.         prefetchBuffer:true,
  48.         onscroll:updateTip
  49.     }
  50.     //新建Rico.LiveGrid对象
  51.     new Rico.LiveGrid("data_grid", 10, 100, "live_grid.jsp", opts);
  52. }
  53. //更新提示信息
  54. function updateTip( liveGrid, offset ) {
  55.     $('tip').innerHTML = "浏览产品 " + (offset+1) + " - " + 
  56.                               (offset+liveGrid.metaData.getPageSize()) + 
  57.                               " of " + liveGrid.metaData.getTotalRows();
  58. }
  59. </script>
  60. </head>
  61. <body onload="init()">
  62. <h1>大量数据动态浏览查询</h1>
  63. <div id="tip" style="font-size:12px">浏览产品</div>
  64. <div id="container">
  65.     <!-- 数据表头 -->
  66.     <table id="data_grid_header" class="fixedTable" cellspacing="0" cellpadding="0" style="width:400px">
  67.     <tr>
  68.         <th class="first tableCellHeader" style="width:40px;text-align:center">NO.</th>
  69.         <th class="tableCellHeader" style="width:280px">名称</th>
  70.         <th class="tableCellHeader" style="width:80px">价格</th>
  71.     </tr>
  72.     </table>
  73.     <!-- 数据容器 -->
  74.     <div id="data_grid_container" style="width:430px">
  75.         <div id="viewPort" style="float:left">
  76.             <table id="data_grid" 
  77.                    class="fixedTable" 
  78.                    cellspacing="0"
  79.                    cellpadding="0" 
  80.                    style="width:400px; border-left:1px solid #ababab" >
  81.             <!-- 循环显示20行供存放数据 -->
  82.             <% for (int i=0; i<20; i++) { %>
  83.             <tr>
  84.                 <td class="cell" style="width:40px;text-align:center"></td>
  85.                 <td class="cell" style="width:280px"></td>
  86.                 <td class="cell" style="width:80px"></td>
  87.             </tr>
  88.             <% } %>
  89.             </table>
  90.         </div>
  91.     </div>
  92. </div>
  93. </body>
  94. </html>