Skip to content

Commit 32f3227

Browse files
authored
Merge pull request mendix#10472 from stdagkalakis/wtf-2288-doc-update-for-primitive-and-optional-page-parameters
Documentation update for page parameters [WTF-2288]
2 parents 86955f9 + 6198ea9 commit 32f3227

10 files changed

Lines changed: 70 additions & 6 deletions

File tree

content/en/docs/refguide/modeling/application-logic/microflows-and-nanoflows/activities/client-activities/show-page.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ You can also open the dialog box by double-clicking the activity, or right-click
4545

4646
### Page
4747

48-
The [page](/refguide/page/) that is displayed to an end-user. If the page has parameters, the [Parameters](#parameters) section allows you to specify the which objects should be passed to the page.
48+
The [page](/refguide/page/) that is displayed to an end-user. If the page has parameters, the [Parameters](#parameters) section allows you to specify which values should be passed to the page.
4949

50-
To create a new page that **Show page** activity will show, click the **Select** button > **New**. Studio Pro will ask you whether you want to pass a variable as an argument to the new page. If you select a variable to pass, Studio Pro will automatically create a page parameter of that type and a data view to edit that object.
50+
To create a new page that **Show page** activity will show, click the **Select** button > **New**. Studio Pro will ask you whether you want to pass a variable as an argument to the new page. If you select a variable to pass, Studio Pro will automatically create a page parameter of that type and a data view to edit that value.
5151

5252
### Page Title
5353

@@ -72,7 +72,7 @@ Often you need to have control of page history, for example to show the correct
7272

7373
### Parameters Section {#parameters}
7474

75-
Depending on the selected page, you will see a list of its parameters. For each parameter, you can configure a variable or expression to specify which object should be passed to it. These objects are used by [data views](/refguide/data-view/) with a page parameter data source. If only one variable of the expected type for a certain parameter is available, that variable is automatically filled in.
75+
Depending on the selected page, you will see a list of its [parameters](/refguide/page-parameter/). For each parameter, you can configure a variable or expression to specify which value should be passed to it. These values are used by [data views](/refguide/data-view/) with a page parameter data source. If only one variable of the expected type for a certain parameter is available, that variable is automatically filled in.
7676

7777
## Common Section{#common}
7878

content/en/docs/refguide/modeling/pages/on-click-event.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ The **Show a page** event opens the specified page. Select the page which opens
9898

9999
#### Page Arguments
100100

101-
**Page arguments** are automatically configured based on the parameters of the selected page and the available arguments. In general, arguments are taken from any enclosing data widget. If the data widget enclosing the widget calling a page is inside another (nested) data widget, then objects from that data widget and any others in which it is nested can also be passed.
101+
**Page arguments** are automatically configured based on the [parameters](/refguide/page-parameter/) of the selected page and the available arguments. In general, arguments are taken from any enclosing data widget or the page itself.
102102

103103
### Call a Microflow {#call-microflow}
104104

content/en/docs/refguide/modeling/pages/page-resources/snippet.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ The values for the platform property are:
4646

4747
#### Parameters {#parameters}
4848

49-
**Snippet Parameters** works the same way as [Page Parameter](/refguide/page-properties/#parameters) with the difference that a snippet's parameter can be accessed at the top level, for example when creating expressions or selecting attributes.
49+
**Snippet parameters** allow snippets to be re-used with different data. They work the same way as [Page Parameters](/refguide/page-properties/#parameters).
50+
51+
{{% alert color="info" %}}
52+
Snippet parameters do not support primitive types and cannot be made optional, like [page parameters](/refguide/page-parameter/) do.
53+
{{% /alert %}}
5054

5155
#### Variables {#variables}
5256

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
title: "Page Parameters"
3+
url: /refguide/page-parameter/
4+
weight: 70
5+
#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.
6+
---
7+
8+
## Introduction
9+
10+
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.
11+
12+
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 `''`:
13+
14+
{{< figure src="/attachments/refguide/modeling/pages/page/page-parameter.png" alt="use an object or primitive value" class="no-border" >}}
15+
16+
## Properties
17+
18+
### Name
19+
20+
* **Name** — The name of the parameter.
21+
22+
### Data Type
23+
24+
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`.
25+
26+
Default: *Object*
27+
28+
### Argument {#argument}
29+
30+
Argument determines whether it is **Required** or **Optional** to [pass an argument](#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.
31+
32+
### Default Value
33+
34+
When argument is set to **Optional**, a default value can be set. The default value is used if no [argument is passed](#passing-arguments) to the parameter. Given the example below, if no argument is passed for `CustomerName`, the page will open with the parameter set to `''`:
35+
36+
{{< figure src="/attachments/refguide/modeling/pages/page/page-parameter-default-value.png" alt="no argument example" max-width=70% >}}
37+
38+
{{% alert color="info" %}}
39+
The default value is used when the argument is omitted during modeling. Not when the argument value is `empty` during runtime.
40+
{{% /alert %}}
41+
42+
## Passing Arguments {#passing-arguments}
43+
44+
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):
45+
46+
{{< figure src="/attachments/refguide/modeling/pages/page/page-parameter-mappings.png" alt="example of passing arguments" width="500px" >}}
47+
48+
### Variable Arguments
49+
50+
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 do not require an argument and can be omitted by selecting `(None)` :
51+
52+
{{< figure src="/attachments/refguide/modeling/pages/page/page-parameter-argument-variable.png" alt="example of variable arguments" max-width=70% >}}
53+
54+
### Expression-Based Arguments
55+
56+
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.
57+
58+
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:
59+
60+
{{< figure src="/attachments/refguide/modeling/pages/page/page-parameter-expression.png" alt="example expression-based arguments" width="500px" >}}

content/en/docs/refguide/modeling/pages/page/page-properties.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ In simple e-commerce applications, the URLs can be configured as follows:
105105

106106
#### Parameters {#parameters}
107107

108-
The list of parameters that this page expects. These parameters can be used by [data views](/refguide/data-view/) with a page parameter data source.
108+
The list of [parameters](/refguide/page-parameter/) that this page expects. These parameters can be used by widgets on the page.
109109

110110
A page parameter is an input that needs to be passed from the calling page, microflow, or nanoflow to the current page. Page parameters determine information that can be reused on the page. For example, if you want to build an **Employee_Details_Edit** page, the page will have a parameter **Employee**. Thus when this page is called an Employee object needs to be passed to it to show the corresponding Employee data.
111111

28.7 KB
Loading
51.3 KB
Loading
48.6 KB
Loading
24 KB
Loading
37.9 KB
Loading

0 commit comments

Comments
 (0)