Methods
# static confirmation(params) → {Promise.<boolean>}
Shows a confirmation dialog before calling a given function.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
params |
Object
|
||
content |
string
|
message to show in the dialog |
|
okText |
string
|
<optional> |
caption for the OK button |
cancelText |
string
|
<optional> |
caption for the cancel button |
true when OK is pressed, false when cancel is pressed
Promise.<boolean>
Example
const confirmed = await confirmation({
content: "Do you really want to eat a burger?",
okText: "I really do",
cancelText: "I'll pass",
});
console.log(`Eating burger: ${confirmed ? "yes" : "no"}`);
# static hideProgress(params)
Hides the progress dialog.
Parameters:
| Name | Type | Description |
|---|---|---|
params |
Object
|
|
progressId |
Big
|
Progress id from |
Example
const progressId = showProgress(); // show progress dialog
hideProgress(progressId); // hide it again
# static reloadApp(params)
Reloads the application, optionally preserving the state of the application.
Note: This method is not supported on native mobile.
With withState: true, the following is preserved across the reload:
- The object cache (all currently loaded
MxObjects) - The currently opened page and its form parameters
- The current locale setting
On React client, the history of the application is also preserved, this includes:
- The navigation stack
- The current index in the navigation stack
- The view state of the current page
Warning: Only use withState when absolutely necessary, such as when you want to maintain any unsaved changes the user might have. To stay on the current page after a reload, consider using page URLs with a regular reload instead.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
params |
Object
|
|||
withState |
boolean
|
<optional> |
false | whether to preserve the application's state (not supported on native mobile) |
When withState is true and the application state exceeds the
browser's sessionStorage quota (typically 5-10 MB). This can happen when the object cache contains a large
amount of data.
ReloadStateQuotaExceededError
Examples
// Regular reload (recommended)
reloadApp();
// Reload preserving application state
reloadApp({ withState: true });
// Reload with state, handling potential quota errors
try {
reloadApp({ withState: true });
} catch (error) {
if (error instanceof ReloadStateQuotaExceededError) {
const shouldContinue = await confirmation({
content: "The application state is too large to preserve. Do you want to continue with a regular reload? Any unsaved changes will be lost.",
okText: "Continue",
cancelText: "Cancel",
});
if (shouldContinue) {
reloadApp({ withState: false });
}
} else {
throw error;
}
}
# static showDialog(params)
Shows a dialog with a message.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
params |
Object
|
|||
type |
"info"
|
"warning"
|
"error"
|
"exception"
|
type of message to show |
||
content |
string
|
message to show |
||
isModal |
boolean
|
<optional> |
false | whether the dialog will be modal or not |
Example
showDialog({
type: "warning",
content: "Let me warn you about something.",
isModal: true
});
# static showLogin(params)
Shows the login screen if it is not already shown.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
params |
object
|
||
messageCode |
number
|
<optional> |
HTTP code triggering the login |
Example
await showLogin(401); // show login screen with indication that session has expired.
# static showProgress(params) → {Big}
Shows the progress dialog.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
params |
Object
|
||
content |
string
|
<optional> |
message to display while progress is visible |
isModal |
boolean
|
<optional> |
whether the progress should be modal |
progress id that can be passed to hideProgress
Big
Examples
Showing default progress dialog
const progressId = showProgress(); // show progress dialog
hideProgress({ progressId });
Showing a modal progress dialog with a message
const progressId = showProgress({ content: "In progress", isModal: true});
hideProgress({ progressId });