The onClose event handler fires when the dialog is about to close. Call args.preventDefault() to cancel the closing.
DayPilot.Modal.onClose(args)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
Use this handler to intercept the close request before the dialog is closed. The args.result value is the same object supplied to close().
const modal = new DayPilot.Modal({
onClose: (args) => {
if (!args.result) {
args.preventDefault();
}
},
// ...
});
modal.showHtml("Hello");