dojo.addOnLoad(function(){
var jsonStore = new dojo.data.ItemFileReadStore({"url":"http://localhost:8080/Sai/samu"});
});
<div dojoType="dijit.form.FilteringSelect" store="jsonStore" required="true" id="MyId" ></div>
我收到错误声明jsonStore未定义。
答案 0 :(得分:0)
您正在混合使用programmatic and declarative Dojo方法。你应该使用其中一个。
<强>程序化:强>
dojo.addOnLoad(function(){
var jsonStore = new dojo.data.ItemFileReadStore({
url: "http://localhost:8080/Sai/samu"
});
var filtSel = new dijit.form.FilteringSelect(
{
id: "MyId",
store: jsonStore,
required: true
},
"MyId" // Id of div to turn into filteringSelect
);
});
...
<div id="MyId"></div>
<强>声明强>
<div dojoType="dojo.data.ItemFileReadStore" jsId="jsonStore" url="http://localhost:8080/Sai/samu"></div>
<div dojoType="dijit.form.FilteringSelect" store="jsonStore" required="true" id="MyId" ></div>