使用 Dojo 库运行此代码时,我收到一个小部件已注册错误。
在控制台中,我可以看到有一个具有此 ID 的小部件,但我无法销毁它。
function layoutDialog2(data, taskBoard, idName)
{
var _idName = idName;
var _taskBoard = taskBoard;
var d = addDialog(); //dialog
var idD = d.get("id"); //random ID
var f = addNew(d, Form, {id: "f"+idD, style: "border: 1px solid red"});
var c = addNew(d, ContentPane, {id: "cp"+idD});
for (var i=0; i<7; i++)
{
var l1 = addNew2(f, "label", {style: "1px solid green"});
var span1 = addNew2(l1, "span", {innerHTML: "a"+i+": "});
var t1 = addNew(l1, TextBox, {name: "a"+i, value: data["a"+i]});
var br1 = addNew2(l1, "br", {});
}
var b1 = addNew(c, Button, {label: "Change", onClick: function() { change(); }});
var b2 = addNew(c, Button, {label: "DELETE", onClick: function() { deleteTask(); }});
function change()
{
console.log(_taskBoard);
_taskBoard.destroyRecursive();
console.log(_taskBoard);
var v1 = registry.byId("f"+idD); //get form value
var v1 = v1.get("value");
layoutTask(v1);
_taskBoard.destroyRecursive();
}
function deleteTask()
{
_taskBoard.destroyRecursive();
}
d.show();
}