DayPilot.Modal.close

The close() method closes the modal dialog. You can send custom parameter to onClose/onClosed event handlers.

Declaration

DayPilot.Modal.close(result);

Parameters

  • result (object) - custom object that will be accessing in onClose/onClosed as args.result

Notes

The close() method can be called on a DayPilot.Modal instance or as a static method.

If you call it on an instance it will close the specified modal dialog:

const modal = new DayPilot.Modal({
  onClose: args => {
    console.log("Modal closed with result", args.result);
  }
});
modal.showHtml("Hi");

// ...

modal.close();

You can also call it as a static method from inside of a modal dialog that uses showUrl() to display a custom page. In that case it will close the last instance:

var modal1 = new DayPilot.Modal();
modal1.showUrl("/page/edit");

Inside "/page/edit":

const result = {
  name: "name from a form"
};
parent.DayPilot.Modal.close(result);