Button 如何在数组中循环后创建多个dojo按钮
在我的数组中循环之后,我正在基于数组对象构建多个按钮。但是,我希望使用数组中的dojo按钮或dijit按钮动态构建按钮。我该怎么做 这就是我所拥有的:Button 如何在数组中循环后创建多个dojo按钮,button,dynamic,dojo,Button,Dynamic,Dojo,在我的数组中循环之后,我正在基于数组对象构建多个按钮。但是,我希望使用数组中的dojo按钮或dijit按钮动态构建按钮。我该怎么做 这就是我所拥有的: array.forEach(this.DYNAMIC_FILTER_FORMS, function (entry, i) { //console.debug(entry, "at index", i); var button = domConstruct.create("button", { id: "menuBtn" + i,
array.forEach(this.DYNAMIC_FILTER_FORMS, function (entry, i) {
//console.debug(entry, "at index", i);
var button = domConstruct.create("button", {
id: "menuBtn" + i,
class: "menuBtnClass",
"name": entry.menuText,
"value": entry.menuText
}, dom.byId("content"));
button.innerHTML = entry.menuText;
我想要这样的东西,但数组中有多个按钮:
// Create a button programmatically:
var myButton = new Button({
label: "Click me!",
onClick: function(){
// Do something:
dom.byId("result1").innerHTML += "Thank you! ";
}
}, "progButtonNode").startup();
你的第一段代码已经对我起作用了o
array.forEach(this.DYNAMIC_FILTER_FORMS, function (entry, i) {
var myButton = new Button({
label: entry.menuText,
onClick: function(){ ... }
});
myButton.placeAt("content");
});