You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An element is part of a Mendix model and all elements together form the logic of the model. Elements may contain other elements. An element always has a container element, which is its parent. The root of an element tree is always a unit.
34
34
35
-
Each component exposes the units info of the units it is responsible for. The full unit content can be accessed only after loading the unit.
35
+
Each component (e.g. `studioPro.app.model.pages` and `studioPro.app.model.domainModels`) exposes the units info of the units it is responsible for. The full unit content can be accessed only after loading the unit.
36
36
37
-
The unit info contains the the following fields:
38
-
| Name | Description |
39
-
| --- | --- |
40
-
|`$ID`| The unique id of the unit |
41
-
|`$Type`| The type of the unit |
42
-
|`moduleName`| (Optional) The name of the module containing the unit |
43
-
|`name`| (Optional) The name of the unit |
37
+
The unit info, described by the `UnitInfo` interface, contains the the following fields:
38
+
| Name | Description |Example value |
39
+
| --- | --- | --- |
40
+
|`$ID`| The unique id of the unit |`077d1338-a548-49a9-baee-c291e93d19af`|
41
+
|`$Type`| The type of the unit |`Pages$Page`|
42
+
|`moduleName`| (Optional) The name of the module containing the unit |`MyFirstModule`|
43
+
|`name`| (Optional) The name of the unit |`ExamplePage`|
44
44
45
45
All the units managed by the DomainModels component can be retrieved by:
Units can be loaded by suppling a function to `loadAll` to execute for each unit. It should return a truthy value to load the unit.
51
+
Units can be loaded by supplying a function to `component.loadAll(fn)` to execute for each unit. The function `fn`should return a truthy value to load the specified unit.
52
52
53
53
The followind snippet loads the DomainModel for the module named `MyFirstModule`:
54
54
55
55
{{% alert color="warning" %}}
56
-
Loading units is an expensive process. Only load the minimun number of units you need when you need them.
56
+
Loading units is a resource intensive process. Only load the minimum number of units you need when you need them.
The Mendix model can be modified by leveraing the `add<ElementName>` helper methods:
79
+
The Mendix model can be modified by leveraging the `add<ElementName>` helper methods.
76
80
77
81
The following snippet will create a new Entity inside the previously loaded DomainModel unit:
78
82
83
+
{{% alert color="warning" %}}
84
+
Do not forget to invoke the `component.save(unit)` method after making changes to your unit. The method must be invoked for each modified unit, so changes on multiple units need to be saved separetely.
0 commit comments