Skip to content

Commit c785d57

Browse files
authored
Merge pull request #8380 from weirdwater/development
[WTF-1940] Allow default values for data sources
2 parents 3392328 + 1a344aa commit c785d57

File tree

1 file changed

+23
-26
lines changed

1 file changed

+23
-26
lines changed

content/en/docs/apidocs-mxsdk/apidocs/frontend/pluggable-widgets/pluggable-widgets-property-types.md

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,6 @@ The return type of the expression must be defined using either the `type` or the
366366

367367
##### Fixed Return Type
368368

369-
{{% alert color="info" %}}
370-
The `type` attribute was required in Mendix [9.19](/releasenotes/studio-pro/9.19/) and below.
371-
{{% /alert %}}
372-
373369
You can set a fixed return type for your expression property with one of the supported types from below.
374370

375371
| Supported Return Types | Corresponding Types Client Components Receive |
@@ -382,10 +378,6 @@ You can set a fixed return type for your expression property with one of the sup
382378

383379
##### Return Type Assignable to an Attribute
384380

385-
{{% alert color="info" %}}
386-
The `assignableTo` attribute was introduced in Mendix [9.20](/releasenotes/studio-pro/9.20/).
387-
{{% /alert %}}
388-
389381
You can use `assignableTo` to specify that the return type of the expression property should depend on the attribute property with the given property path. This means that the value of the expression will be assignable to the attribute configured for that attribute property (using [`setValue`](/apidocs-mxsdk/apidocs/pluggable-widgets-client-apis/#editable-value)).
390382

391383
The client component will receive a `DynamicValue<T>` where `T` depends on the possible types of the target attribute. If the attribute property allows for more than one type, the type of the actual value depends on the attribute that has been configured.
@@ -574,14 +566,6 @@ Then the Studio Pro UI for the property appears like this:
574566

575567
### Association {#association}
576568

577-
{{% alert color="info" %}}
578-
This property type was introduced in Mendix [9.13](/releasenotes/studio-pro/9.13/).
579-
{{% /alert %}}
580-
581-
{{% alert color="info" %}}
582-
The ability to link association properties to a data source was introduced in Mendix [9.17](/releasenotes/studio-pro/9.17/).
583-
{{% /alert %}}
584-
585569
The association property type allows a widget to work directly with both reading and writing associations between entities. Depending on the widget's purposes, a widget should define association types it supports.
586570

587571
If a `dataSource` attribute is not specified the client will receive a `ReferenceValue` for references (singular references), a `ReferenceSetValue` for reference sets (multiple references), or a union of them. For more information, see the [ModifiableValue](/apidocs-mxsdk/apidocs/pluggable-widgets-client-apis/#modifiable-value) section of *Client APIs Available to Pluggable Widgets*.
@@ -710,10 +694,6 @@ Then the Studio Pro UI for the property appears like this:
710694

711695
The datasource property allows widgets to work with object lists. The client component will receive value prop of type [`ListValue`](/apidocs-mxsdk/apidocs/pluggable-widgets-client-apis-list-values/#listvalue) and may be used with [`action`](#action), [`attribute`](#attribute), [`association`](#association), [`expression`](#expression), [`text template`](#texttemplate), and [`widgets`](#widgets) properties. See [Data Sources](/refguide/data-sources/#list-widgets) for available data source types.
712696

713-
{{% alert color="info" %}}
714-
The ability to link association properties to a data source was introduced in Mendix [9.17](/releasenotes/studio-pro/9.17/).
715-
{{% /alert %}}
716-
717697
If no data source has been configured by the user, any properties that are linked to the datasource property are automatically omitted from the props passed to the client component (even if they are marked as required).
718698

719699
{{% alert color="warning" %}}
@@ -722,12 +702,29 @@ Only list datasources are supported, therefore specifying `isList="true"` is req
722702

723703
#### XML Attributes
724704

725-
| Attribute | Required | Attribute Type | Description |
726-
|------------|----------|----------------|---------------------------------------------------------------------------------|
727-
| `type` | Yes | String | Must be `datasource` |
728-
| `key` | Yes | String | See [key](#key) |
729-
| `isList` | Yes | Boolean | Must be `true` |
730-
| `required` | No | Boolean | This decides if the user is required to specify a datasource, `true` by default |
705+
| Attribute | Required | Attribute Type | Description |
706+
|----------------|----------|----------------|------------------------------------------------------------------------------------------------------------|
707+
| `type` | Yes | String | Must be `datasource` |
708+
| `key` | Yes | String | See [key](#key) |
709+
| `isList` | Yes | Boolean | Must be `true` |
710+
| `required` | No | Boolean | This decides if the user is required to specify a datasource, `true` by default |
711+
| `defaultType` | No | String | Default type for the property, supported values are `Database`, `Microflow`, `Nanoflow`, and `Association` |
712+
| `defaultValue` | No | String | Default value for the property, see [Default Data Sources](#data-source-defaults) |
713+
714+
##### Data Source Defaults {#data-source-defaults}
715+
716+
{{% alert color="info" %}}
717+
The `defaultType` and `defaultValue` attributes for datasources were introduced in Mendix [10.16](/releasenotes/studio-pro/10.16/).
718+
{{% /alert %}}
719+
720+
You can use the `defaultType` and `defaultValue` attributes to configure default data sources for your widget. Unless overridden in Studio Pro, the widget will attempt to configure the data source according to its defaults. Both attributes need to be set for the defaults to be applied.
721+
722+
The format of `defaultValue` depends on the chosen `defaultType`:
723+
724+
| Data source type | Format | Example |
725+
|--------------------------|-------------|-----------------------------------------------------------------------|
726+
| `Database` `Association` | Entity Path | `ModuleName.EntityName` or `ModuleName.A/ModuleName.A_B/ModuleName.B` |
727+
| `Microflow` `Nanoflow` | Document ID | `ModuleName.DocumentName` |
731728

732729
#### Studio Pro UI
733730

0 commit comments

Comments
 (0)