DayPilot.Modal.close

The close() method closes the modal dialog and can pass a custom value to DayPilot.Modal.onClose and DayPilot.Modal.onClosed.

Declaration

DayPilot.Modal.close(result)

Parameters

Notes

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.

Example

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);

See Also

DayPilot.Modal.onClose

DayPilot.Modal.onClosed

DayPilot.Modal.showUrl()

DayPilot Modal [code.daypilot.org]

DayPilot.Modal Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript