问题描述:

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

网友答案:

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.

相关阅读:
Top