Dialog

A simple, basic dialog containing a content pane with an 'Apply' and 'Cancel' button.

This widget inherits from http://dojotoolkit.org/reference-guide/1.10/dijit/Dialog.html.

Example
// @formatter:off
define([
  "dojo/_base/declare",
  "dojo/_base/lang",
  "dojo/on",
  "dijit/layout/ContentPane",
  "dijit/_WidgetBase",
  "blueconic/api/widgets/dialog/Dialog"
// @formatter:on
], function(declare, lang, on, ContentPane, _WidgetBase, Dialog) {

  return declare("your.package.widget", [_WidgetBase], {

    postCreate: function() {
      // call super
      this.inherited(arguments);

      // initialize the dialog
      var dialog = new Dialog({
        title: "title here",
        content: new ContentPane({
          content: "content here",
          baseClass: "bcDialogContent" // this CSS class adds a default padding
        }),
        width: 300,
        height: 100
      });

      // @formatter:off
      this.own(
        on(dialog, "execute", lang.hitch(this, function() {
          // do something on execute
        })),
        on(dialog, "cancel", lang.hitch(this, function() {
          // do something on cancel
        }))
      );
      // @formatter:on

      dialog.show();
    }
  });
});

Properties

content String, dijit/_WidgetBase

The widget (or text) used for the dialog content.

title String

The title of the dialog.

Functions

hide()

Hides dialog and the containing widget.

Shows the dialog and resizes it afterwards.

Returns:
Type Description
dojo/Deferred Promise object that resolves when the display animation is complete.

Events

onCancel()

Event thrown on a click on the 'Cancel' button. After this event is thrown, the dialog is closed.

onExecute()

Event thrown on a click on the execute button. After this event is thrown, the dialog is always closed.