我正在尝试使用 jQuery 动态插入行。除了组合框没有出现在行中之外,它可以与以下代码一起正常工作。我已经解析了组合框,但它仍然没有出现并在行中显示“Design Abbr [Widget dijit.form.ComboBox,solutionAbbr1]”。实际上我在这里期待一个组合框。谁能给我一些帮助来解决这个问题。我对 jquery 和 dojo 都使用 1.8 版本。
var maxcount = 0;
require(["dojo/parser", "dojo/dom", "dojo/store/Memory", "dijit/form/ComboBox", "dojo/domReady!"],
function(parser, dom, Memory, ComboBox){
this.addBlock = function() {
maxcount += 1;
var stateStore = new Memory({data: [{name:"Alabama", id:"AL"},
{name:"Alaska", id:"AK"},{name:"Armed Forces the Americas", id:"AA"},
{name:"California", id:"CA"},{name:"Connecticut", id:"CT"}]});
var comboBoxId = "solutionAbbr"+maxcount;
var comboBox = new ComboBox({id: comboBoxId, name: "solutionAbbr",
value: "California",store: stateStore,searchAttr: "name"}, "stateSelect");
//parser.parse.then(function(comboBox) {document.getElementById("solutionAbbr"+maxcount)});
parser.parse(dijit.byId(comboBoxId));
//alert(dijit.byId(comboBoxId).get('value'));
$('<tr id="idForNewRow'+maxcount+'">'
+'<td colspan="4">'
+'<table id="idForBorder">'
+'<tr class="even">'
+'<th align="left"><font color="red">Design Abbr</font></th>'
+'<td align="left" valign="bottom" colspan="3">'
+comboBox+'</td>'
+'</tr>'
+'</table></td></tr><tr><td colspan="4"><a href="javascript:removeRow('
+maxcount+')">Remove</a>').insertAfter("[id*=idForNewRow]:last");
}
});