0
嗨,我只想填充選擇或組合框。 我能夠將searchAttr同時填充爲來自JSON的任何字符串。但是當有空值時不是這樣。dojo 1.8:使用包含空值的數據庫項目填充選擇框
JSON字符串:
[{"batch":"0000001000"},{"batch":"0000"},{"batch":""},{"batch":null}]
道場代碼:
var selBatch = new ComboBox //located at the left side of the page and it is the second select box in a row
(
{ id:'ID_selBatch',
value:'',
searchAttr:'batch',
placeHolder:'Select...',
style:{width:'150px'},
}, 'node_selBatch'
);
on(selTest, 'change', function(valueCard)
{
var selectedTest = this.get('displayedValue');
var selBatch = registry.byId('ID_selBatch');
console.debug('Connecting to gatherbatches.php ...');
request.post('gatherbatches.php',
{ data:{nameDB:registry.byId('ID_selPCBA').value, nameCard : valueCard},
handleAs: "json"}).then
(
function(response)
{
var memoStore2 = new Memory({data:response});
selBatch.set('store', memoStore2);
selBatch.set('value','');
console.debug('List of batches per Test is completed! Good OK! ');
},
function(error)
{
alert("Batch's Error:"+error);
console.debug('Problem: Listing batches per Test in select Test is BAD!');
}
);
selBatch.startup();
});
錯誤:
TypeError: _32[this.searchAttr] is null
defer() -> _WidgetBase.js (line 331)
_3() -> dojo.js (line 15)
_f.hitch(this,fcn)(); -> _WidgetBase.js (line 331)
請告知,雖然它可能奇怪,有NULL值的選擇框,但這些填充空值與數據庫中其他列中的數據相關,因此包含空值以便我可以應用之後的mysql腳本。或者你還有其他更好的建議嗎?
克萊門特