How do you create event handler for "x" button on type: 'floating' widget?

"OnClose" fires every time: this.parentWidget.hide(); is called.

I want to intercept the event when the "x" button in the title bar is clicked.


Based on my interpretation of your question, I believe that you'd want an onClose method in your widget. This code from the _FloatingWidgetMixin.js file is where that gets handled and directed to your onClose method:

if (this.parentWidget && this.parentWidget.declaredClass === 'gis.dijit.FloatingWidget' && this.onClose) {
    on(this.parentWidget, 'hide', lang.hitch(this, 'onClose'));

This would get fired when closing the dialog either by clicking the 'X' OR when the user presses the Escape key.

The Help Widget has an example of handling the event when the dialog is opened.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.