2.jsp
上传用户:zaktkj
上传日期:2022-08-08
资源大小:5770k
文件大小:3k
源码类别:

JavaScript

开发平台:

JavaScript

  1. <%@ page contentType="text/html;charset=utf-8"%>
  2. <%
  3.     String ctx = request.getContextPath();
  4.     String ext = ctx + "/../ext-2.0";
  5.     pageContext.setAttribute("ctx", ctx);
  6.     pageContext.setAttribute("ext", ext);
  7. %>
  8. <html>
  9.     <head>
  10.         <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  11.         <title>DWRProxy</title>
  12.         <link rel="stylesheet" type="text/css" href="${ext}/resources/css/ext-all.css" />
  13.         <script type="text/javascript" src="${ext}/adapter/ext/ext-base.js"></script>
  14.         <script type="text/javascript" src="${ext}/ext-all.js"></script>
  15.         <script type="text/javascript" src="${ctx}/dwr/interface/infoManager.js"></script>
  16.         <script type="text/javascript" src="${ctx}/dwr/engine.js"></script>
  17.         <script type="text/javascript" src="${ctx}/dwr/util.js"></script>
  18.         <script type="text/javascript" src="DWRProxy.js"></script>
  19.         <script type="text/javascript">
  20. Ext.BLANK_IMAGE_URL = '${ext}/resources/images/default/s.gif';
  21. Ext.onReady(function(){
  22.     var info = Ext.data.Record.create([
  23.         {name: 'id', type: 'int'},
  24.         {name: 'name', type: 'string'},
  25.         {name: 'sex', type: 'int'},
  26.         {name: 'email', type: 'string'},
  27.         {name: 'tel', type: 'string'},
  28.         {name: 'addTime'},
  29.         {name: 'descn', type: 'string'}
  30.     ]);
  31.     var cm = new Ext.grid.ColumnModel([
  32.         {header:'编号',dataIndex:'id'},
  33.         {header:'名称',dataIndex:'name'},
  34.         {header:'性别',dataIndex:'sex'},
  35.         {header:'邮箱',dataIndex:'email'},
  36.         {header:'电话',dataIndex:'tel'},
  37.         {header:'添加时间',dataIndex:'addTime'},
  38.         {header:'备注',dataIndex:'descn'}
  39.     ]);
  40.     var store = new Ext.data.Store({
  41.         proxy: new Ext.data.DWRProxy(infoManager.getItems, true),
  42.         reader: new Ext.data.ListRangeReader({
  43.             totalProperty: 'totalSize',
  44.             root: 'data',
  45.             id: 'id'
  46.         }, info),
  47.         remoteSort: true
  48.     });
  49.     var grid = new Ext.grid.GridPanel({
  50.         renderTo: 'grid',
  51.         autoHeight: true,
  52.         store: store,
  53.         cm: cm,
  54.         bbar: new Ext.PagingToolbar({
  55.             pageSize: 10,
  56.             store: store,
  57.             displayInfo: true,
  58.             displayMsg: '显示第 {0} 条到 {1} 条记录,一共 {2} 条',
  59.             emptyMsg: "没有记录"
  60.         })
  61.     });
  62.     store.load({params:{start:0,limit:10}});
  63. });
  64.         </script>
  65.     </head>
  66.     <body>
  67.         <h1>DWRProxy</h1>
  68.         <a href="index.jsp">返回</a>
  69.         <hr>
  70.         <div id="grid" style="height:300px;"></div>
  71.     </body>
  72. </html>