Dialogs

This section includes the three Mojo dialog APIs:

  • Error dialog

  • Alert dialog

  • Custom dialog

Each entry includes a brief description, repeating some of the information from Chapter 4, followed by an enumeration of the arguments. Dialogs are accessed through a direct API so the format for this entry will be structured as an API entry.

Mojo.Controller.errorDialog()

This API is used to post error messages in a modal dialog box with a fixed title of “Error,” a customizable message, and a confirmation button. The Error dialog must be used only with errors, since you can’t change the title.

Arguments

Type

Description

message

String

Displayed message in a modal dialog

window

Element

Optional argument to specify the window to post the alert within; required in multistage applications

Mojo.Controller.SceneController.showAlertDialog()

You can display a short message using an Alert dialog, with one or more HTML buttons presenting the selection options. This is the best option if you have either a nonerror message for the user or want to present options in the form of button selections.

Arguments

Type

Description

onChoose
FunctionHandler called when user makes a choice and the dialog is dismissed
message

String

Displayed message in a modal dialog

title

String

Title of the dialog box

preventCancel

Boolean

If true, back gesture or other alerts will not cancel the dialog box

choices

Array

Array of button descriptions; each entry is required to be:

{label: 'string', value: value, type: 'string', 
allowHTMLMessage: boolean}

The number of entries defines the number of buttons presented in the dialog box; the type property is set to one of the button classes (e.g., primary, secondary, affirmative, negative); allowHTMLMessage set to allow insertion of HTML if safe

allHTMLMessage

Boolean

If true, the message string will not have HTML escaped

Mojo.Controller.SceneController.showDialog()

The showDialog function can display any type of content to the user in the form of a modal dialog box. You can put anything into a dialog box that you’d put into a scene, meaning almost any web content or Mojo UI content.

Arguments

Type

Description

template

String

File path to HTML template containing content for the dialog box; rendered with properties from this model object

assistant

Object

The dialog assistant responsible for running the dialog box, which must implement methods (setup, activate, deactivate, cleanup, and handleCommand)

preventCancel

Boolean

If true, back gesture or other alerts will not cancel the dialog box

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.36.56