-
Notifications
You must be signed in to change notification settings - Fork 767
Draft: [WTF-2288]: Documentation update for page parameters #10472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
stdagkalakis
wants to merge
4
commits into
mendix:development
Choose a base branch
from
stdagkalakis:wtf-2288-doc-update-for-primitive-and-optional-page-parameters
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
content/en/docs/refguide/modeling/pages/page/page-parameter.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| --- | ||
| title: "Page Parameters" | ||
| url: /refguide/page-parameter/ | ||
| weight: 70 | ||
| #If moving or renaming this doc file, implement a temporary redirect and let the respective team know they should update the URL in the product. See Mapping to Products for more details. | ||
| --- | ||
|
|
||
| ## Introduction | ||
|
|
||
| Parameters are the means by which you pass data to your page. When a page is loaded, the parameters are filled with the current values. | ||
|
|
||
| To use an object or primitive value in your page, define a parameter. In the image below, the parameter is named **CustomerName**, is of type string, is not required, and has a default value of an empty string `''`. | ||
|
|
||
| {{< figure src="/attachments/refguide/modeling/pages/page/page-parameter.png" class="no-border" >}} | ||
|
|
||
| ## Mappings | ||
|
|
||
| ### Name | ||
|
|
||
| **Name** refers to the name of the parameter. | ||
|
|
||
| ### Data Type | ||
|
|
||
| The data type of a parameter defines the type of the value that it expects. Possible data types are **objects**, and **primitives** such as `Boolean`, `Date and time`, `Decimal`, `Enumeration`, `Integer/Long`, and `String`. | ||
|
|
||
| Default: *Object* | ||
|
|
||
| ### Argument {#argument} | ||
|
|
||
| Argument determines whether it is **required** or **optional** to [pass an argument](/refguide/page-parameter/#passing-arguments) to the parameter when opening the page. If it is required it is mandatory to supply an argument for that parameter when opening a page. | ||
|
|
||
| ### Default Value | ||
|
|
||
| When an argument is set to **optional**, a default value can be set. When a default value is set if the parameter is omitted, the default value will be used. In the example below, if the parameter is omitted by the user an empty string `''` will be used for the parameter. | ||
|
|
||
| {{< figure src="/attachments/refguide/modeling/pages/page/page-parameter-default-value.png" max-width=70% >}} | ||
|
|
||
| {{% alert color="info" %}} | ||
| The default value is used when the argument is omitted during **modeling**. Not when the argument value is `empty` during **runtime**. | ||
| {{% /alert %}} | ||
|
|
||
| ## Passing Arguments {#passing-arguments} | ||
|
|
||
| Arguments are passed to page parameters when a page is opened. For example, using a **Show page** action [on a widget event](/refguide/on-click-event/#show-page) or in a [microflow](/refguide/show-page/). For each parameter the page has an argument can be configured. It is only necessary to pass arguments to [required parameters](#argument). | ||
|
|
||
| {{< figure src="/attachments/refguide/modeling/pages/page/page-parameter-mappings.png" width="500px" >}} | ||
|
|
||
| ### Variable Arguments | ||
ConnorLand marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| Variable arguments are used to pass parameters from the context to the page. This is done by selecting from the available variables on the page presented in the dropdown. **Optional** parameters don't require an argument and can be omitted by selecting `(None)` . | ||
|
|
||
| {{< figure src="/attachments/refguide/modeling/pages/page/page-parameter-argument-variable.png" max-width=70% >}} | ||
|
|
||
| ### Expression-Based Arguments | ||
|
|
||
| Objects and primitive values, such as `Boolean`, `Date and time`, `Decimal`, `Enumeration`, `Integer/Long`, and `String`, can be passed and used in expressions. This method allows users to use functions and follow associations within the expression to set the argument values. Using expressions for arguments provides flexibility in setting values and improves the functionality of pages. In the example below, the page has a parameter **AnimalName** which is populated by an expression extracting the **Name** member of the provided **Animal** object: | ||
|
|
||
| {{< figure src="/attachments/refguide/modeling/pages/page/page-parameter-expression.png" width="500px" >}} | ||
Binary file added
BIN
+28.7 KB
...c/attachments/refguide/modeling/pages/page/page-parameter-argument-variable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+51.3 KB
static/attachments/refguide/modeling/pages/page/page-parameter-default-value.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+48.6 KB
static/attachments/refguide/modeling/pages/page/page-parameter-expression.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+24 KB
static/attachments/refguide/modeling/pages/page/page-parameter-mappings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.