Skip to content

Commit 09de473

Browse files
nielslyngsoegitbook-bot
authored andcommitted
GITBOOK-13: Property dataset updates
1 parent fd6acf6 commit 09de473

File tree

1 file changed

+48
-9
lines changed

1 file changed

+48
-9
lines changed
Lines changed: 48 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,64 @@
11
---
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.
35
---
46

57
# Property Dataset Context
68

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.
1010

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.
1212

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:
1414

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
1653

1754
A Dataset Context is the connection point between a Property Editor and a Workspace.
1855

56+
The Workspace has the root ownership, where the Dataset represents a specific Variant.
57+
1958
The hierarchy is as follows:
2059

2160
* Workspace Context
22-
* Dataset Context
61+
* Property Dataset Context
2362
* Property Editor UIs
2463

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

Comments
 (0)