1
我看不到有什麼問題,但錯誤控制檯顯示:「_21.store.fetch不是函數」。組合框只是不填充。我嘗試了Memory和ItemFileWriteStore,兩者都不起作用!怎麼了?我使用dojo 1.6.1順便說一句。 的代碼如下:Dojo組合框出錯,「store.fetch不是函數」
<html>
<head>
<script type="text/javascript" src="dojo/dojo.js.uncompressed.js"></script>
<link rel="stylesheet" type="text/css" href="dojo/resources/dojo.css"></style>
<link rel="stylesheet" type="text/css" href="dijit/themes/claro/claro.css"></style>
<script type="text/javascript">
dojo.require("dijit.form.ComboBox");
dojo.require("dojo.store.Memory");
dojo.require("dojo.data.ItemFileWriteStore");
dojo.require("dojo.data.ItemFileReadStore");
</script>
<script type="text/javascript">
dojo.ready(function(){
var rateStore, rate;
rateStore = new dojo.store.Memory({
data: [
{id:1, name:"1 X"},
{id:2, name:"2 X"},
{id:4, name:"4 X"},
{id:6, name:"6 X"},
{id:8, name:"8 X"},
{id:10, name:"10 X"}
]
});
/*
rateStore = new dojo.data.ItemFileWriteStore({
data: {
items:[
{id:1, name:"1 X"},
{id:2, name:"2 X"},
{id:4, name:"4 X"},
{id:6, name:"6 X"},
{id:8, name:"8 X"},
{id:10, name:"10 X"}
]
}
});
*/
rate = new dijit.form.ComboBox({
id: "rate",
name: "rate",
store: rateStore,
searchAttr: name,
style: "width:50px"
}, dojo.byId("rate"));
rate.startup();
});
</script>
</head>
<body class="claro">
<div id="rate"></div>
</body>
</html>
我hv解決了alr,這是由於'searchAttr:「name」'... – yeeen