766525a69c91ffe7b1dc7d169bbab46e68afe834.svn-base 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <%@page language="java" pageEncoding="UTF-8"%>
  2. <%
  3. String path = request.getContextPath();
  4. %>
  5. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  6. <html xmlns="http://www.w3.org/1999/xhtml">
  7. <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  9. <title>基本表格模板</title>
  10. <!--框架必需start-->
  11. <script type="text/javascript" src="<%=path%>/libs/js/jquery.js"></script>
  12. <script type="text/javascript" src="<%=path%>/libs/js/language/cn.js"></script>
  13. <script type="text/javascript" src="<%=path%>/libs/js/framework.js"></script>
  14. <link href="<%=path%>/libs/css/import_basic.css" rel="stylesheet" type="text/css"/>
  15. <link rel="stylesheet" type="text/css" id="skin" prePath="<%=path%>/" scrollerY="false"/>
  16. <link rel="stylesheet" type="text/css" id="customSkin"/>
  17. <!--框架必需end-->
  18. <!--数据表格start-->
  19. <script src="<%=path%>/libs/js/table/quiGrid.js" type="text/javascript"></script>
  20. <!--数据表格end-->
  21. <!--分页start-->
  22. <script type="text/javascript" src="<%=path%>/libs/js/nav/pageNumber.js"></script>
  23. <!--分页end-->
  24. </head>
  25. <body>
  26. <div class="red">此示例由后台支持</div>
  27. <div class="padding_right5">
  28. <div id="maingrid"></div>
  29. </div>
  30. <div id="pageContent" style="height:35px;"></div>
  31. <script type="text/javascript">
  32. var g_pageNo = 1;
  33. var g_pageSize = 10;
  34. //数据表格使用
  35. var g;
  36. var gridData;
  37. function initComplete(){
  38. g = $("#maingrid").quiGrid({
  39. columns: [
  40. { display: '姓名', name: 'userName', align: 'left', width: "20%"},
  41. { display: '所属部门', name: 'orgName', align: 'left', width: "20%"},
  42. { display: '性别', name: 'userSex', align: 'left', width: "20%"},
  43. { display: '入职时间', name: 'userEmployTime', align: 'left', width:"20%"} ,
  44. { display: '学历', name: 'userEducation', align: 'left', width:"20%"}
  45. ],
  46. data:[], sortName: 'userId',rownumbers:true,dataAction:'local',checkbox:true,usePager: false,
  47. height: '100%', width:"100%",heightDiff:-40,percentWidthMode:true,
  48. onChangeSort : function(){
  49. getData(g.options.sortName,g.options.sortOrder,g_pageNo,g_pageSize);
  50. return false;
  51. }
  52. });
  53. }
  54. $(function(){
  55. g.options.sortName = "userId";
  56. g.options.sortOrder = "desc";
  57. getData(g.options.sortName,g.options.sortOrder,g_pageNo,g_pageSize);
  58. })
  59. function getData(sort,direction,pageNo,pageSize){
  60. $.post("<%=path%>/getUsersOfPager.action",
  61. {"sort":sort,
  62. "direction":direction,
  63. "pager.pageNo":pageNo,
  64. "pager.pageSize":pageSize
  65. },
  66. function(result){
  67. gridData = result;
  68. //刷新表格
  69. g.loadData(gridData);
  70. var $pager=$('<div class="pageNumber" showSelect="true"></div>');
  71. $pager.attr("total",gridData["pager.totalRows"]);
  72. var $pagerCon = $('<div class="float_left padding5">' + "共有" + gridData["pager.totalRows"] + "条记录" + '</div><div class="float_right padding5"></div><div class="clear"></div>');
  73. $pagerCon.eq(1).append($pager);
  74. $("#pageContent").append($pagerCon);
  75. $pager.render();
  76. $pager.bind("pageChange",function(e,index){
  77. g_pageNo = index + 1;
  78. getData2(g.options.sortName,g.options.direction,g_pageNo,g_pageSize);
  79. })
  80. $pager.bind("sizeChange",function(e,num){
  81. g_pageSize = num;
  82. getData2(g.options.sortName,g.options.sortOrder,g_pageNo,g_pageSize);
  83. })
  84. },"json");
  85. }
  86. function getData2(sort,direction,pageNo,pageSize){
  87. $.post("<%=path%>/getUsersOfPager.action",
  88. {"sort":sort,
  89. "direction":direction,
  90. "pager.pageNo":pageNo,
  91. "pager.pageSize":pageSize
  92. },
  93. function(result){
  94. gridData = result;
  95. //刷新表格
  96. g.loadData(gridData);
  97. },"json");
  98. }
  99. </script>
  100. </body>
  101. </html>