DayPilot.Modal.onClose

The onClose event handler fires when the dialog is about to close. Call args.preventDefault() to cancel the closing.

Declaration

DayPilot.Modal.onClose(args)

Parameters

  • args.backgroundClick (boolean) - true if the modal is closing because of a click on the background <div>

  • args.result - custom parameter passed to close()

  • args.preventDefault() - cancels the closing

Notes

Use this handler to intercept the close request before the dialog is closed. The args.result value is the same object supplied to close().

Example

const modal = new DayPilot.Modal({
  onClose: (args) => {
    if (!args.result) {
      args.preventDefault();
    }
  },
  // ...
});
modal.showHtml("Hello");

See Also

DayPilot.Modal.close

DayPilot.Modal.onClosed

DayPilot.Modal Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript