Basic UI functionality.
Methods
(static) action(namenon-null, params, scope)
Executes a Microflow from the UI.
This is basically a wrapper around mx.data.action,
giving the option of showing a progress bar while running the Microflow.
Parameters:
| Name | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| name | string | name of the Microflow to execute | |||||||||
| params | Object | Properties
 | |||||||||
| scope | Object | scope in which to execute the callback and error callbacks | 
- Deprecated:
- since version 8.0, use mx.data.actioninstead
 
- since version 8.0, use 
- See:
- 
        - mx.data.actionfor the other accepted parameters
 
Example
define([ "mendix/lib/MxContext" ], function(MxContext) {
     mx.ui.action("MyFirstModule.StartEngine", {
         context: new MxContext(),
         progress: "modal",
         callback: function(result) {
             console.log("Engine started: " + result);
         }
     });
});(static) back()
Goes one step back in history, closing the current in content Form.
(static) confirmation(content, proceed, cancel, handler)
Shows a confirmation dialog before calling a given function.
Parameters:
| Name | Type | Description | 
|---|---|---|
| content | string | message to show in the dialog | 
| proceed | string | caption for the proceed button | 
| cancel | string | caption for the cancel button | 
| 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.
Returns:
widget template node
- Type
- 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 | Properties
 | ||||||||||||||||||||||
| 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(messageCode)
Shows the login screen if it is not already shown.
Parameters:
| Name | Type | Description | 
|---|---|---|
| messageCode | number | 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 | 
Returns:
progress id that can be used to close the dialog again
- Type
- number
Examples
Showing default progress dialog
var pid = mx.ui.showProgress(); // show progress dialog
mx.ui.hideProgress(pid); // hide it againShowing 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 warningType 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.