$.udb.closePage()
This article is about the closePage() function of the $.udb object.
$.udb.closePage()
Closes the page and returns to the previous page on the stack.
Returns a UdbPromise object.
If you navigate away from a page, asynchronous operations are in risk of being annulled if they do not return a Promise (as opposed to just executing with an undefined result).
Syntax
$.udb.closePage( [options] )
.then(() => {
// success (executed after page is closed)
})
.catch(() => {
// failure (executed on the original page)
})
.finally(() => {
// executed after success / failure is handled
});
*options* ::= {
[accept]: *accept*,
[check]: *check*,
[quiet]: *quiet*,
[steps]: *steps*,
[messages]: *messages*
}
*accept* ::= { true | [false] }
*check* ::= { [true] | false }
*quiet* ::= { true | [false] }
*steps* ::= Integer [1]
*messages* ::= [Array[0]]
Options is a struct that can have the following items, all of which are optional.
Accept has an effect only if the page being closed is a lookup page. It determines whether the current lookup value is accepted or not. The default is false, meaning that by default, if a lookup page is closed the current value is not accepted as lookup value. See also .acceptLookupValue() for details.
Check has an effect only if there are unchecked data manipulations. It determines whether such manipulations are checked. The default is true, meaning that if there are unchecked data manipulations, they are checked by default.
Quiet is a boolean determining whether messages are displayed during the operation or not. The default is false, meaning that messages are displayed by default.
Steps is an integer determining the number of pages that are closed. The default is 1, meaning that only the current page is closed by default.
Messages is an array of strings that is passed to the previous page, which then are displayed there. By default this array is empty, which means no messages will be displayed.
Examples
$.udb.closePage({ accept: true, quiet: true });
$.udb.closePage()
.then(() => {
// executed on the previous page, which is displayed after the current page is closed
})
.catch(() => {
// executed when an error occurs, the page is not closed
})
.finally(() => {
// executed after .then() or .catch(), regardless if the page was closed or not
});
Related events
| Event | Applies to | Occurs when |
|---|---|---|
| beforenavigate | Page objects | Before the page is getting closed |