Namespace

ui

mx.ui

Basic UI functionality.

Methods

# static back()

Goes one step back in history, closing the current in content Form.

# static confirmation()

Shows a confirmation dialog before calling a given function.

Parameters:
Name Type Description
args.content string

message to show in the dialog

args.proceed string

caption for the proceed button

args.cancel string

caption for the cancel button

args.handler mx.ui~ConfirmationCallback

function to call when the proceed button is clicked

Example
mx.ui.confirmation({
    content: "Do you really want to eat a burger?",
    proceed: "I really do",
    cancel: "I'll pass",
    handler: function() {
        console.log("eating burger");
    }
});

# static error(msg, modal)

Shows an error message.

Parameters:
Name Type Description
msg string

message to show

modal boolean

whether the dialog will be modal or not

Example
mx.ui.error("Something went wrong."); // shows a non-modal error

# static exception(msg)

Shows a message for a fatal error in a modal dialog.

Parameters:
Name Type Description
msg string

message to show

Example
mx.ui.exception("Something went very wrong."); // shows a modal fatal error

# static getTemplate() → {DocumentFragment}

Gets a template for a specific widget.

widget template node

DocumentFragment
Example
mx.ui.getTemplate("12", "content"); // Template 'content' for widget with mxid '12'

# static hideProgress()

Hides the loading dialog.

Example
var pid = mx.ui.showProgress(); // show progress dialog
mx.ui.hideProgress(pid); // hide it again

# static info(msg, modal)

Shows an information message.

Parameters:
Name Type Description
msg string

message to show

modal boolean

whether the dialog will be modal or not

Example
mx.ui.info("Let me inform you about something.", false); // shows a non-modal warning

# static openForm(path, args, scopenullable)

Opens a form, either in content, in a DOM node or in a (modal) popup.

Parameters:
Name Type Attributes Description
path string

path to the form

args Object
location string

location to open the form, either content, popup, modal or node.

domNode DOMNode

DomNode to open the form in, overrides args.location

title string

Title of the form. If omitted, the title from the form template is used.

context mendix/lib/MxContext

context passed to the form

callback mx.ui~OpenFormSuccessCallback

Function to be called when ready. Not supported when args.location is set to content.

error mx.ui~OpenFormErrorCallback

Function to be called when an error occurs. Not supported when args.location is set to content.

scope Object <nullable>

scope in which the error and callback handler are invoked

Example
mx.ui.openForm("MyFirstModule/Puppies.page.xml", {
    location: "popup",
    callback: function(form) {
        console.log(form.id);
    }
});

# static reload(callback)

Reloads the current form which is opened in content.

Parameters:
Name Type Description
callback mx.ui~ReloadCallback

function to be called when done

# static showLogin(messageCodeopt)

Shows the login screen if it is not already shown.

Parameters:
Name Type Attributes Description
messageCode number <optional>

HTTP code triggering the login

Example
mx.ui.showLogin(401); // show login screen with indication that session has expired.

# static showProgress(msgopt, modalopt) → {number}

Shows the loading dialog.

Parameters:
Name Type Attributes Description
msg string <optional>

message to display while progress is visible

modal boolean <optional>

whether the progress should be modal

progress id that can be used to close the dialog again

number
Examples

Showing default progress dialog

var pid = mx.ui.showProgress(); // show progress dialog
mx.ui.hideProgress(pid); // hide it again

Showing a modal progress dialog with a message

var pid = mx.ui.showProgress("In progress", true);
mx.ui.hideProgress(pid);

# static warning(msg, modal)

Shows a warning message.

Parameters:
Name Type Description
msg string

message to show

modal boolean

whether the dialog will be modal or not

Example
mx.ui.warning("Let me warn you about something.", true); // shows a modal warning

Type Definitions

# ConfirmationCallback()

Callback for mx.ui.confirmation for when the user confirms

# OpenFormErrorCallback(error)

Error callback for mx.ui.openForm

Parameters:
Name Type Description
error Error

error describing the failure of the call

# OpenFormSuccessCallback(form)

Success callback for mx.ui.openForm

Parameters:
Name Type Description
form mxui/lib/form/_FormBase

form that was opened

# ReloadCallback()

Callback for mx.ui.reload for when reloading of the form is done.