The close() method closes the modal dialog and can pass a custom value to DayPilot.Modal.onClose and DayPilot.Modal.onClosed.
DayPilot.Modal.close(result)result (object) - custom object available in DayPilot.Modal.onClose and DayPilot.Modal.onClosed as args.result
You can call close() on a DayPilot.Modal instance or as a static method.
Calling it on an instance closes that specific modal dialog. If you don't need to return a value, you can call the instance method without the result argument.
Calling it as a static method from inside content displayed using DayPilot.Modal.showUrl() closes the last open modal dialog.
Closing a specific instance:
const modal = new DayPilot.Modal({
onClose: (args) => {
console.log("Modal closed with result", args.result);
}
});
modal.showHtml("Hi");
// ...
modal.close();Closing the last open modal from a page loaded using DayPilot.Modal.showUrl():
const modal = new DayPilot.Modal();
modal.showUrl("/page/edit");Inside /page/edit:
const result = {
name: "name from a form"
};
parent.DayPilot.Modal.close(result);DayPilot Modal [code.daypilot.org]