dojo过滤选择不正常工作

时间:2012-03-20 12:17:34

标签: dojo filtering

我正在尝试使用以下代码来实现dojo过滤选择,但显示没有错误的奇怪显示。

我刚刚更换了源js文件,因为哪些功能正在运行但问题仍然存在

http://o.aolcdn.com/dojo/1.2.3/dojo/dojo.xd.js

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Simple FilterSelect Example</title>
  <style type="text/css">
  @import "../dijit/themes/soria/soria.css";
  @import "/resources/dojo.css";
  </style>
  <script type="text/javascript" src="http://o.aolcdn.com/dojo/1.2.3/dojo/dojo.xd.js" djConfig="parseOnLoad: true"></script>
  <script type="text/javascript">
 dojo.require("dojo.parser");
 dojo.require("dijit.form.FilteringSelect");
 </script>
</head>
<body class="soria">
  <select dojoType="dijit.form.FilteringSelect" name="countryName" autocomplete="true"
  value="sel">
  <option value="sel" selected="selected">Austria</option>
  <option value="1" >Australia</option>
  <option value="2" >Canada</option>
  <option value="3" >Germany</option>
  <option value="4" >Japan</option>
  <option value="5" >United Kingdom</option>
  <option value="6" >United States of America</option>
  <option value="7" >Afghanistan</option>
  <option value="8" >Albania</option>
  <option value="9" >Algeria</option>
  <option value="10" >American Samoa</option>
  <option value="11" >Andorra</option>
  <option value="12" >Angola</option>
  </select>
</body>
</html>

2 个答案:

答案 0 :(得分:0)

这应该有效,但是我怀疑你的样式表没有加载。试试谷歌的CDN:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Simple FilterSelect Example</title>
  <style type="text/css">
  @import "http://ajax.googleapis.com/ajax/libs/dojo/1.2.3/dijit/themes/soria/soria.css";
  @import "http://ajax.googleapis.com/ajax/libs/dojo/1.2.3/dojo/resources/dojo.css";
  </style>
  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/dojo/1.2.3/dojo/dojo.xd.js" djConfig="parseOnLoad: true"></script>
  <script type="text/javascript">
 dojo.require("dojo.parser");
 dojo.require("dijit.form.FilteringSelect");
 </script>
</head>
<body class="soria">

<div style="padding:2em"><!-- for visibility -->

  <select dojoType="dijit.form.FilteringSelect" name="countryName" autocomplete="false"
  value="sel" queryExpr="*${0}*">
  <option value="sel" selected="selected">Austria</option>
  <option value="1" >Australia</option>
  <option value="2" >Canada</option>
  <option value="3" >Germany</option>
  <option value="4" >Japan</option>
  <option value="5" >United Kingdom</option>
  <option value="6" >United States of America</option>
  <option value="7" >Afghanistan</option>
  <option value="8" >Albania</option>
  <option value="9" >Algeria</option>
  <option value="10" >American Samoa</option>
  <option value="11" >Andorra</option>
  <option value="12" >Angola</option>
  </select>

</div>

</body>
</html>

此外,我建议调整过滤选择以autocomplete="false"queryExpr="*${0}*"

答案 1 :(得分:0)

是的,它可能是CSS /样式问题 - 请检查firebug中的Net选项卡以确保没有404s

我也只是用你的标记创建了一个jsfiddle,它似乎在流行的浏览器中运行得很好。结帐:

http://jsfiddle.net/jA4KX/

你可以改变小提琴以匹配你的道场版本并玩它

HTH