|
1 | 1 | ---
|
2 |
| -description: The Variant Context is a context that holds the data for a set of properties. |
| 2 | +description: >- |
| 3 | + The owner of the values for properties, enabling you to communicate with other |
| 4 | + properties. |
3 | 5 | ---
|
4 | 6 |
|
5 | 7 | # Property Dataset Context
|
6 | 8 |
|
7 |
| -{% hint style="warning" %} |
8 |
| -This page is a work in progress and may undergo further revisions, updates, or amendments. The information contained herein is subject to change without notice. |
9 |
| -{% endhint %} |
| 9 | +Property Editors UIs require a Dataset Context to be present for them to work. This enables Property Editor UIs to have a generic relationship with their ownership and work in various cases. |
10 | 10 |
|
11 |
| -Property Editors UIs require the Dataset Context to be present to work. This enables Property Editor UIs to have a generic relation with its ownership. |
| 11 | +The Dataset Context holds a name for the entity and a set of property values. |
12 | 12 |
|
13 |
| -The Dataset Context holds a name and a set of properties. What makes a property can vary but an alias and a value are required. |
| 13 | +Retrieve a reference to the Property Dataset Context to start communicating: |
14 | 14 |
|
15 |
| -### Dataset Context Concerning Property Editors and Workspaces |
| 15 | +```typescript |
| 16 | +this.consumeContext(UMB_PROPERTY_DATASET_CONTEXT, async (context) => { |
| 17 | + ... |
| 18 | +}); |
| 19 | +``` |
| 20 | + |
| 21 | +### Observe the value of another Property |
| 22 | + |
| 23 | +Observe a value if you are using it in your UI. In the following example, the \`alias\` is used to retrieve the value of another property: |
| 24 | + |
| 25 | +```typescript |
| 26 | +this.consumeContext(UMB_PROPERTY_DATASET_CONTEXT, async (context) => { |
| 27 | + this.observe( |
| 28 | + await context?.propertyValueByAlias("alias-of-other-property"), |
| 29 | + (value) => { |
| 30 | + console.log("the value of the other property", value) |
| 31 | + } |
| 32 | + ); |
| 33 | +}); |
| 34 | +``` |
| 35 | + |
| 36 | +### Set the value of another Property |
| 37 | + |
| 38 | +You can alter the value of another property in this way: |
| 39 | + |
| 40 | +```typescript |
| 41 | +this.consumeContext(UMB_PROPERTY_DATASET_CONTEXT, async (context) => { |
| 42 | + this.datasetContext = context; |
| 43 | +}); |
| 44 | + |
| 45 | +... |
| 46 | + |
| 47 | +updateValue() { |
| 48 | + this.datasetContext?.setPropertyValue("alias-of-other-property", "The updated value"); |
| 49 | +} |
| 50 | +``` |
| 51 | + |
| 52 | +### Dataset Context in relation to Property Editors and Workspaces |
16 | 53 |
|
17 | 54 | A Dataset Context is the connection point between a Property Editor and a Workspace.
|
18 | 55 |
|
| 56 | +The Workspace has the root ownership, where the Dataset represents a specific Variant. |
| 57 | + |
19 | 58 | The hierarchy is as follows:
|
20 | 59 |
|
21 | 60 | * Workspace Context
|
22 |
| - * Dataset Context |
| 61 | + * Property Dataset Context |
23 | 62 | * Property Editor UIs
|
24 | 63 |
|
25 |
| -A dataset context covers a set of properties, in some cases a workspace then needs to have multiple variants. An example of such is Document Workspace. Each variant has its own set of properties and a name. |
| 64 | +If you want to set or read values from properties of the same variant, use the Property Dataset Context. If you need values from another variant, use the Workspace Context instead. |
0 commit comments