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

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和ComboBox</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.     ]);
  26.     var store = new Ext.data.Store({
  27.         proxy: new Ext.data.DWRProxy(infoManager.getItems, true),
  28.         reader: new Ext.data.ListRangeReader({
  29.             totalProperty: 'totalSize',
  30.             root: 'data',
  31.             id: 'id'
  32.         }, info)
  33.     });
  34.     var combo = new Ext.form.ComboBox({
  35.         store: store,
  36.         displayField: 'name',
  37.         valueField: 'id',
  38.         triggerAction: 'all',
  39.         typeAhead: true,
  40.         mode: 'remote',
  41.         emptyText: '请选择',
  42.         selectOnFocus: true
  43.     });
  44.     combo.render('combo');
  45. });
  46.         </script>
  47.     </head>
  48.     <body>
  49.         <h1>DWRProxy和ComboBox</h1>
  50.         <a href="index.jsp">返回</a>
  51.         <hr>
  52.         <div id="combo" style="height:300px;"></div>
  53.     </body>
  54. </html>