dijit/form/ComboBox 是选择元素和文本框的混合体。我有:- 为 3 个记忆选择 3 个选项 每次选择“已更改”时,ComboBox 都会填充选定的记忆 该项目可以在 ComboBox 中选择。再次选择内存并在 ComboBox 中填充
一切似乎都很好,但是... ComoBox 的文本框无法更新以反映内存的变化。甚至不能将其设置为空白。我尝试使用 value:""; 或占位符:""; 但无济于事。
meter_Select.on('change', function()
{
//registry.byId('batchSelect').destroyrescursive();
console.debug("selected -> " + meter_Select.value);
switch(meter_Select.value)
{
case 'testdata1970_05': var memoStore2 = new Memory({data:response2});
break;
case 'testdata1970_10': var memoStore2 = new Memory({data:response3});
break;
case 'testdata2060_03': var memoStore2 = new Memory({data:response1});
}
//memoStore2.put({"mfg_code":""});// it works but it needs to be moved to the top!
var combx = registry.byId('cardSelect');// at first it will be undefined
console.debug('ComboBox Select(1A) ='+combx);
if(combx)//if combx exists or already defined
{
combx.store = memoStore2;
combx.value = "";
combx.placeHolder = "Choose one of the batch...";
//combx.domAttr.set('cardSelect','displayedValue','');
console.debug('ComboBox Select(1C) ='+combx);
//domAttr.set('batchSelect','store','nemoStore2');
}
else
{// if combx does not exist or is not defined yet
combx = new ComboBox({
id: 'cardSelect',
store: memoStore2,
searchAttr: "mfg_code",
value :"",
placeHolder: "Choose one of the batch..."
}, "node_cardSelect");
console.debug('ComboBox Select(1B) ='+combx);
}
combx.startup();
您可以在jsFiddle Link上 查看请告知。提前致谢