当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - 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.

网友答案:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: