Reputation: 3504
I've a problem with dojo.connect
when i try to connect a dijit button
to his 'onclick'
method if the button is part of a TooltipDialog
content.
This code doesn't give me errors, but it seems not to connect the event (so if I click at the button nothing happens).
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);
}
});
//-----------------------------------
}
debugging, i can see that w
is the correct dijit button that i need to connect.
Any ideas?
Upvotes: 0
Views: 853
Reputation: 5710
You need proper case on the event name, and that should be it:
dojo.connect(w, "onClick" ....
For regular DOM nodes, like a , the case doesn't matter. But since a dijit Button's click event is just a javascript function in the Button class, proper case is required.
Upvotes: 1