Documentation

Dialog

The Dialog module provides a mechanism for launching modal dialogs from within an add-on's iframe. A modal dialog displays information without requiring the user to leave the current page. The dialog is opened over the entire window, rather than within the iframe itself.

For more information, read about the Atlassian User Interface dialog component.

Methods

close(data)

Closes the currently open dialog. Optionally pass data to listeners of the dialog.close event. This will only close a dialog that has been opened by your add-on. You can register for close events using the dialog.close event and the events module

Parameters:
Name Type Description
data Object

An object to be emitted on dialog close.

Example
AP.require('dialog', function(dialog){
  dialog.close({foo: 'bar'});
});

create()

Creates a dialog for a module key

Example
AP.require('dialog', function(dialog){
  dialog.create('mydialog');
});

getButton() → {DialogButton}

Returns the button that was requested (either cancel or submit)

Returns:
DialogButton
Example
AP.require('dialog', function(dialog){
  dialog.getButton('submit');
});

onDialogMessage(String, Function)

register callbacks responding to messages from the host dialog, such as "submit" or "cancel"

Parameters:
Name Type Description
String

button either "cancel" or "submit"

Function

callback function

This functionality is deprecated and may be removed in the future.