Skip to main content

modal.alert

ModalAlert : d2/sdk/controls/modal.alert

Shows a modal alert.

Different static methods could be used to show different type of modal alerts.

Extends: Marionette.View
Example (A sample invocation to show a confirmation alert)

define([
'd2/sdk/controls/modal.alert'
], function(ModalAlert){
'use strict';

var buttonOptions = {
showYes: true,
labelYes: 'Ok',
showNo: false,
showCancel: true,
labelCancel: 'Cancel'
};

ModalAlert.confirmQuestion(function(result){
if(result) {
console.log('Clicked OK');
} else {
console.log('Clicked Cancel');
}
}, 'sample message', 'Sample Title', {
buttons: buttonOptions
});
});

ModalAlert.ButtonOptions

A few pre-configured button options to ease up modal creation with preset

Kind: static property of ModalAlert
Todo

  • Describe different button options

ModalAlert.showSuccess([callback], [message], [title], [options]) ⇒ PromiseReturnType

Shows a success modal alert

Kind: static method of ModalAlert

ParamTypeDescription
[callback]AlertDissolveCallback

Executed with a hint about user interaction.

[message]string

The message to be shown.

[title]string

Title of the alert.

[options]OptionsType

A single option hash to customize the modal title, message & button options

ModalAlert.showInformation([callback], [message], [title], [options]) ⇒ PromiseReturnType

Shows a info modal alert

Kind: static method of ModalAlert

ParamTypeDescription
[callback]AlertDissolveCallback

Executed with a hint about user interaction.

[message]string

The message to be shown.

[title]string

Title of the alert.

[options]OptionsType

A single option hash to customize the modal title, message & button options

ModalAlert.showWarning([callback], [message], [title], [options]) ⇒ PromiseReturnType

Shows a warning modal alert

Kind: static method of ModalAlert

ParamTypeDescription
[callback]AlertDissolveCallback

Executed with a hint about user interaction.

[message]string

The message to be shown.

[title]string

Title of the alert.

[options]OptionsType

A single option hash to customize the modal title, message & button options

ModalAlert.showError([callback], [message], [title], [options]) ⇒ PromiseReturnType

Shows an error modal alert

Kind: static method of ModalAlert

ParamTypeDescription
[callback]AlertDissolveCallback

Executed with a hint about user interaction.

[message]string

The message to be shown.

[title]string

Title of the alert.

[options]OptionsType

A single option hash to customize the modal title, message & button options

ModalAlert.showMessage([callback], [message], [title], [options]) ⇒ PromiseReturnType

Shows a generic modal alert without associating with a type

Kind: static method of ModalAlert

ParamTypeDescription
[callback]AlertDissolveCallback

Executed with a hint about user interaction.

[message]string

The message to be shown.

[title]string

Title of the alert.

[options]OptionsType

A single option hash to customize the modal title, message & button options

ModalAlert.confirmSuccess([callback], [message], [title], [options]) ⇒ PromiseReturnType

Shows an interrogative modal alert representing success

Kind: static method of ModalAlert

ParamTypeDescription
[callback]AlertDissolveCallback

Executed with a hint about user interaction.

[message]string

The message to be shown.

[title]string

Title of the alert.

[options]OptionsType

A single option hash to customize the modal title, message & button options

ModalAlert.confirmInformation([callback], [message], [title], [options]) ⇒ PromiseReturnType

Shows an interrogative modal alert representing information

Kind: static method of ModalAlert

ParamTypeDescription
[callback]AlertDissolveCallback

Executed with a hint about user interaction.

[message]string

The message to be shown.

[title]string

Title of the alert.

[options]OptionsType

A single option hash to customize the modal title, message & button options

ModalAlert.confirmWarning([callback], [message], [title], [options]) ⇒ PromiseReturnType

Shows an interrogative modal alert representing warning

Kind: static method of ModalAlert

ParamTypeDescription
[callback]AlertDissolveCallback

Executed with a hint about user interaction.

[message]string

The message to be shown.

[title]string

Title of the alert.

[options]OptionsType

A single option hash to customize the modal title, message & button options

ModalAlert.confirmError([callback], [message], [title], [options]) ⇒ PromiseReturnType

Shows an interrogative modal alert representing error

Kind: static method of ModalAlert

ParamTypeDescription
[callback]AlertDissolveCallback

Executed with a hint about user interaction.

[message]string

The message to be shown.

[title]string

Title of the alert.

[options]OptionsType

A single option hash to customize the modal title, message & button options

ModalAlert.confirmQuestion([callback], [message], [title], [options]) ⇒ PromiseReturnType

Shows a generic interrogative modal alert

Kind: static method of ModalAlert

ParamTypeDescription
[callback]AlertDissolveCallback

Executed with a hint about user interaction.

[message]string

The message to be shown.

[title]string

Title of the alert.

[options]OptionsType

A single option hash to customize the modal title, message & button options

ModalAlert.confirmMessage([callback], [message], [title], [options]) ⇒ PromiseReturnType

Shows a generic interrogative modal alert representing a message

Kind: static method of ModalAlert

ParamTypeDescription
[callback]AlertDissolveCallback

Executed with a hint about user interaction.

[message]string

The message to be shown.

[title]string

Title of the alert.

[options]OptionsType

A single option hash to customize the modal title, message & button options

ModalAlert~AlertDissolveCallback ⇒ void

Callback type invoked, when the modal dissolves.

Kind: inner typedef of ModalAlert

ParamTypeDescription
resultboolean | undefined

true indicates 'Yes' button, false indicates 'No' and undefined indicates the modal was cancelled.

ModalAlert~PromiseReturnType : jQuery.Promise

Return type. Associated jQuery.Promise instance is resolve()-ed or reject()-ed to indicate whether user pressed 'Yes' or some other button respectively.

Kind: inner typedef of ModalAlert

ModalAlert~OptionsType : Object

Customize modal's title, message, button labels and configuration

Kind: inner typedef of ModalAlert
Todo

  • Enumerate different properties