dacabdi
dacabdi

Reputation: 343

Prevent dijit.TooltipDialog from closing

How to prevent a dijit.TooltipDialog from closing? I want it to close only when the user clicks in certain button.

Upvotes: 0

Views: 873

Answers (1)

springrolls
springrolls

Reputation: 1331

I assume you have a widget as your content. Broadcast a button click event from there and register an event handler in the class where your TooltipDialog is. Use popup.open and close to manually handle your TooltipDialog.

// class WidgetWithButton
on(button, 'click', function(evt) {
    this.onButtonClick(evt);
});

// this is your class
var yourWidget = new WidgetWithButton();
var myTooltipDialog = new TooltipDialog({
    id: 'myTooltipDialog',
    content: yourWidget
});
on(yourWidget, 'buttonClick', function(evt) {
    popup.close(myTooltipDialog);
});
on(dom.byId('thenode'), 'mouseover', function() {
    popup.open({
        popup: myTooltipDialog,
        around: dom.byId('thenode')
    });
});

Hope this helps.

Upvotes: 1

Related Questions