如果按钮是内容的一部分,dojo.connect
当我尝试将 a 连接dijit button
到他的方法时,我遇到了问题。'onclick'
TooltipDialog
这段代码没有给我错误,但它似乎没有连接事件(所以如果我点击按钮没有任何反应)。
dialog = new dijit.TooltipDialog({
id: dialogPrefix + dialogId,
content: content
});
if (closeOnBlur) {
// stuff
} else {
dialog.setContent('<div class="closePopupWrapper"><button dojoType="dijit.form.Button" type="button" id="closePopup_' + dialogId + '" >X</button></div>' + dialog.content);
dialog.getChildren().forEach(function(w) {
if (w.id == 'closePopup_' + dialogId) {
//------------THIS CONNECT DOESN'T WORK
dojo.connect(
w,
"onclick",
function(e) {
if (this.open) {
dojo.enabu.main.animatedpopup.close(this);
}
});
//-----------------------------------
}
调试,我可以看到这w
是我需要连接的正确 dijit 按钮。
有任何想法吗?