简体   繁体   中英

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM