0
我在測試文件中有以下內容。我正在嘗試將選定的值從filteringselect寫入divid。它第一次正常工作,但下一次沒有發生過濾(下拉菜單中沒有可用的值)。 對於第一次更改過濾選擇onchange被調用成功。FilteringSelect第二次不工作
請幫助我找到問題。我是道場新手。 DOJO版本 - 道場1.8
<script>
require([
"dojo/store/Memory", "dijit/form/FilteringSelect", "dojo/domReady!"
], function(Memory, FilteringSelect){
var stateStore = new Memory({
data: [
{name:"Alabama", id:"AL"},
{name:"Alaska", id:"AK"},
{name:"American Samoa", id:"AS"},
{name:"Arizona", id:"AZ"},
{name:"Arkansas", id:"AR"},
{name:"Armed Forces Europe", id:"AE"},
{name:"Armed Forces Pacific", id:"AP"},
{name:"Armed Forces the Americas", id:"AA"},
{name:"California", id:"CA"},
{name:"Colorado", id:"CO"},
{name:"Connecticut", id:"CT"},
{name:"Delaware", id:"DE"}
]
});
var filteringSelect = new FilteringSelect({
id: "stateSelect",
name: "state",
placeHolder: "Select a State",
store: stateStore,
searchAttr: "name",
onChange: function(value) {
var text1 = document.getElementById("divid").innerHTML
document.getElementById("divid").innerHTML = text1 + dijit.byId('stateSelect').attr('displayedValue') + ';';
}
}, "stateSelect");
});
</script>
<div id="divid">
Select a State : <input id="stateSelect">
</div>