Dialog
Updated on Aug 17, 2023 5 minutes to readTo utilize the methods offered by this plugin, you should call them through the E8App.$dialog object.
Alert
Syntax:
E8App.$dialog.alert(<text>, <title>)
Description:
Displays a modal window with an optional message, title and OK button.
Parameters:
<text> - optional
Type: String
A message (can contain html code) to display in a modal window.
<title> - optional
Type: String
A title to display in a modal window. It can contain html code.
Returned value:
None.
E8App.$dialog.alert('<div class="text-success">Hello</div>', 'Greeting')
Close
Syntax:
E8App.$dialog.close()
Description:
Closes a modal.
Returned value:
None.
E8App.$dialog.close();
Confirm
Syntax:
E8App.$dialog.confirm(<text>, <title>)
Description:
Displays a modal dialog with an optional message, title and two buttons – OK and Cancel.
Parameters:
<text> - optional
Type: String
A message (can contain html code) to display in a modal dialog.
<title> - optional
Type: String
A title to display in a modal window. It can contain html code.
Returned value:
A promise that resolves and produces an object representing the confirmation result.
Type: Object.
{ “value”: <boolean> True - if the user clicked OK button/“dismiss”: <string> "cancel" if the user clicked Cancel button,“isConfirmed”: <boolean> returns True if the user clicked OK button, otherwise False,
“isDismissed”: <boolean> returns True if the user clicked Cancel button, otherwise False }
E8App.$dialog.confirm('Press a button', 'Confirm');
Danger
Syntax:
E8App.$dialog.danger(<text>, <title>)
Description:
Displays a modal window with an optional message, title and OK button.
Parameters:
<text> - optional
Type: String
A message (can contain html code) to display in a modal dialog.
<title> - optional
Type: String
A title to display in a modal window. It can contain html code.
Returned value:
A promise resolves to the object representing the result of closing a modal.
Type: Object.
{ “value”: <boolean> True,“isDissmissed”: <boolean> False,
“isConfirmed”: <boolean> True }
E8App.$dialog.danger('Danger!', “It’s a danger dialog”);
Info
Syntax:
E8App.$dialog.info(<text>, <title>)
Description:
Displays a modal with an optional message, title and OK button.
Parameters:
<text> - optional
Type: String
A message (can contain html code) to display in a modal dialog.
<title> - optional
Type: String
A title to display in a modal window. It can contain html code.
Returned value:
A promise that resolves and produces an object representing the result of closing a modal window.
Type: Object.
{ “value”: <boolean> True,“isDissmissed”: <boolean> False,
“isConfirmed”: <boolean> True }
E8App.$dialog.info('Info message');
Question
Syntax:
E8App.$dialog.question(<text>, <title>)
Description:
Displays a modal window with an optional message, title, YES and NO buttons.
Parameters:
<text> - optional
Type: String
A message (can contain html code) to display in a modal dialog.
<title> - optional
Type: String
A title to display in a modal window. It can contain html code.
Returned value:
A promise that resolves and produces an object representing the result of closing a modal dialog.
Type: Object.
{ “value”: <boolean> True - if the user clicked YES button/“dismiss”: <string> "cancel" if the user clicked NO button,“isConfirmed”: <boolean> returns True if the user clicked YES button, otherwise False,
“isDismissed”: <boolean> returns True if the user clicked NO button, otherwise False }
E8App.$dialog.question('Are you sure you want to save changes?', 'Question');
Spinner
Syntax:
E8App.$dialog.spinner()
Description:
Displays a modal dialog with a spinner element.
Returned value:
Void.
E8App.$dialog.spinner();
Success
Syntax:
E8App.$dialog.success(<text>, <title>)
Description:
Displays a dialog with optional message, title and OK button.
Parameters:
<text> - optional
Type: String
A message (can contain html code) to display in a modal dialog.
<title> - optional
Type: String
A title to display in a modal window. It can contain html code.
Returned value:
A promise resolves to the object representing the result of closing a modal dialog.
Type: Object.
{ “value”: <boolean> True,“isDissmissed”: <boolean> False,
“isConfirmed”: <boolean> True }
E8App.$dialog.success('Changes have been saved', 'Success');
Warning
Syntax:
E8App.$dialog.warning(<text>, <title>)
Description:
Displays a dialog with optional message, title and OK button.
Parameters:
<text> - optional
Type: String
A message (can contain html code) to display in a modal dialog.
<title> - optional
Type: String
A title to display in a modal window. It can contain html code.
Returned value:
A promise resolves to the object representing the result of closing a modal dialog.
Type: Object.
{ “value”: <boolean> True,“isDissmissed”: <boolean> False,
“isConfirmed”: <boolean> True }
E8App.$dialog.warning('The application cannot be installed', 'Warning');