Skip to content

Commit b4700bb

Browse files
committed
Updated articles
1 parent 4bf404b commit b4700bb

File tree

8 files changed

+466
-180
lines changed

8 files changed

+466
-180
lines changed

15/umbraco-ui-builder/collections/child-collection-groups.md

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
description: Configuring child collection groups in Umbraco UI Builder, the backoffice UI builder for Umbraco.
2+
description: Configuring child collection groups in Umbraco UI Builder.
33
---
44

55
# Child Collection Groups
@@ -12,27 +12,41 @@ A child collection group is a container for other child collections. Its purpose
1212

1313
![Child Collection Groups](../images/child_collection_groups.png)
1414

15-
## Defining a child collection group
15+
## Defining a Child Collection Group
1616

1717
You can define a child collection group by calling one of the `AddChildCollectionGroup` methods on a given collection config builder instance.
1818

19-
### **AddChildCollectionGroup(string name, Lambda childCollectionGroupConfig = null) : ChildCollectionGroupConfigBuilder**
19+
### Using the `AddChildCollectionGroup()` Method
2020

21-
Adds a child collection group to the current collection with the given name and default icon.
21+
Adds a child collection group to the current collection with the specified name and default icon.
22+
23+
#### Method Syntax
24+
25+
```cs
26+
AddChildCollectionGroup(string name, Lambda childCollectionGroupConfig = null) : ChildCollectionGroupConfigBuilder
27+
```
28+
29+
#### Example
2230

2331
```csharp
24-
// Example
2532
collectionConfig.AddChildCollectionGroup("Family", childCollectionGroupConfig => {
2633
...
2734
});
2835
```
2936

30-
### **AddChildCollectionGroup(string name, string icon, Lambda childCollectionGroupConfig = null) : ChildCollectionGroupConfigBuilder**
37+
### Using the `AddChildCollectionGroup()` Method with Custom Icon
38+
39+
Adds a child collection group to the current collection with the specified name and custom icon.
40+
41+
#### Method Syntax
42+
43+
```cs
44+
AddChildCollectionGroup(string name, string icon, Lambda childCollectionGroupConfig = null) : ChildCollectionGroupConfigBuilder
45+
```
3146

32-
Adds a child collection group to the current collection with the given name and icon.
47+
#### Example
3348

3449
```csharp
35-
// Example
3650
collectionConfig.AddChildCollectionGroup("Family", "icon-users", childCollectionGroupConfig => {
3751
...
3852
});
Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
description: Configuring child collections in Umbraco UI Builder, the backoffice UI builder for Umbraco.
2+
description: Configuring child collections in Umbraco UI Builder.
33
---
44

55
# Child Collections
@@ -8,40 +8,51 @@ description: Configuring child collections in Umbraco UI Builder, the backoffice
88
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.
99
{% endhint %}
1010

11-
A child collection is a container for a given data model that is tied to a parent collection data model. It shares all of the [Collections](the-basics.md) config builder API except child collections cannot contain further child collections.
12-
11+
A child collection is a container for data models that are tied to a parent collection. The child collection system shares the [Collections](the-basics.md) API, offering flexibility for managing and displaying related data within your backoffice UI.
1312
![Child Collections](../images/child_collections.png)
1413

15-
{% hint style="info" %}
16-
**Child Collections UI:** By default, child collections will be presented in the UI as context apps in the parent models editor view. If you have multiple child collections that make the context apps area overpopulated, you can use the [Child Collection Groups API](child-collection-groups.md). By using this you can group child collections under a single context app with the inner child collections then being presented in tabs.
17-
{% endhint %}
14+
By default, child collections are displayed as context apps within the parent model's editor view. If multiple child collections lead to an overcrowded context apps area, consider using the [Child Collection Groups API](child-collection-groups.md). Using the aPI you can group related child collections under a single context app, with each child collection appearing in separate tabs.
15+
16+
## Defining a Child Collection
17+
18+
To define a child collection, use the `AddChildCollection` method on the given collection config builder instance.
19+
20+
### Using the `AddChildCollection()` Method
1821

19-
## Defining a child collection
22+
This method adds a child collection with the specified names, description, and default icons. Both the entity ID and foreign key fields must be specified using property accessor expressions.
2023

21-
You define a child collection by calling one of the `AddChildCollection` methods on a given collection config builder instance.
24+
#### Method Syntax
2225

23-
### **AddChildCollection<TChildEntityType>(Lambda idFieldExpression, Lambda fkFieldExpression, string nameSingular, string namePlural, string description, Lambda childCollectionConfig = null) : ChildCollectionConfigBuilder<TEntityType>**
26+
```cs
27+
AddChildCollection<TChildEntityType>(Lambda idFieldExpression, Lambda fkFieldExpression, string nameSingular, string namePlural, string description, Lambda childCollectionConfig = null) : ChildCollectionConfigBuilder<TEntityType>
28+
```
2429

25-
Adds a child collection to the current collection with the given names and description and default icons. A property accessor expression is required for both the entity ID field and FK (Foreign Key) field of the entity.
30+
#### Example
2631

2732
```csharp
28-
// Example
2933
collectionConfig.AddChildCollection<Child>(c => c.Id, c => c.ParentId, "Child", "Children", "A collection of children", childCollectionConfig => {
3034
...
3135
});
3236
```
3337

34-
### **AddChildCollection&lt;TChildEntityType&gt;(Lambda idFieldExpression, Lambda fkFieldExpression, string nameSingular, string namePlural, string description, string iconSingular, string iconPlural, Lambda childCollectionConfig = null) : ChildCollectionConfigBuilder&lt;TEntityType&gt;**
38+
### Using the `AddChildCollection()` Method with Custom Icons
39+
40+
This method adds a child collection to the current collection with the specified names, description and custom icons. Both the entity ID and foreign key fields must be specified using property accessor expressions.
41+
42+
#### Method Syntax
43+
44+
```cs
45+
AddChildCollection<TChildEntityType>(Lambda idFieldExpression, Lambda fkFieldExpression, string nameSingular, string namePlural, string description, string iconSingular, string iconPlural, Lambda childCollectionConfig = null) : ChildCollectionConfigBuilder<TEntityType>
46+
```
3547

36-
Adds a child collection to the current collection with the given names, description and icons. A property accessor expression is required for both the entity ID field and FK (Foreign Key) field of the entity.
48+
#### Example
3749

3850
```csharp
39-
// Example
4051
collectionConfig.AddChildCollection<Child>(c => c.Id, c => c.ParentId, "Child", "Children", "A collection of children", "icon-umb-users", "icon-umb-users", childCollectionConfig => {
4152
...
4253
});
4354
```
4455

45-
## Configuring a child collection
56+
## Configuring a Child Collection
4657

47-
Child collections share the same API as the `Collection` config builder API, except child collections cannot contain further child collections. For more information check the [core collections documentation](the-basics.md).
58+
Child collections share the same API as the `Collection` config builder API, except child collections cannot contain further child collections. For more information, see the [Basics](the-basics.md) article.
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
---
2-
description: Configuring field views in Umbraco UI Builder, the backoffice UI builder for Umbraco.
2+
description: Configuring Field Views in Umbraco UI Builder.
33
---
44

55
# Field Views
66

7-
Field Views allow you to customize the markup used by a field when displayed in a list view. Field Views are implemented as .NET Core View Components that are passed a single `FieldViewsContext` argument with information about the entity/field being rendered.
7+
Field Views allow customization of the markup used by a field when displayed in a list view. Field Views are implemented as .NET Core View Components, which are passed a `FieldViewsContext` argument containing information about the entity/field being rendered.
88

9-
## Defining a field view
9+
## Defining a Field View
1010

11-
You can define a field view in one of two ways.
11+
You can define a field view in one of two ways:
1212

13-
### **1. A basic view file for the built in `FieldView` view component**
13+
### 1. Basic View File for the Built-In `FieldView` View Component
1414

15-
The simplest way to define a field view for non-complex fields is to place a view file in the `/Views/Shared/Components/FieldView` folder with the following markup.
15+
For field views, place a view file in the `/Views/Shared/Components/FieldView` folder with the following markup.
1616

1717
````csharp
1818
@model Umbraco.UIBuilder.Web.Models.FieldViewContext
1919
<!-- Insert your markup here -->
2020
````
2121

22-
When registering a basic file view you can pass the name of the view file (excluding the `.cshtml` file extension) to the relevant API method.
22+
WTo register the view, pass the name of the view file (excluding the `.cshtml` file extension) to the relevant API method.
2323

24-
### **2. A complete custom view component**
24+
### 2. Custom View Component
2525

26-
To define a more complex field view you can create your own view component class (which can use dependency injection for any required dependencies). This can be done by using the following signature:
26+
For more complex field views, create a custom view component class that can use dependency injection for any required dependencies. Use the following signature:
2727

2828
````csharp
2929
// Example
@@ -39,19 +39,19 @@ public class MyComplexFieldViewViewComponent : ViewComponent
3939
````
4040

4141
{% hint style="info" %}
42-
It's important to know that the `FieldViewContext` parameter to the `InvokeAsync` method **MUST** be named `context`.
42+
The `FieldViewContext` parameter in the `InvokeAsync` method **must** be named `context`.
4343
{% endhint %}
4444

45-
For the view element of your component, based on the example above, you would place a file `Default.cshtml` into the `/Views/Shared/Components/MyComplexFieldView` folder with the following markup:
45+
For the view component, place a `Default.cshtml` file into the `/Views/Shared/Components/MyComplexFieldView` folder with the following markup:
4646

4747
````csharp
4848
@model Namespace.Of.Model.Returned.By.Custom.ViewComponent
4949
<!-- Insert your markup here -->
5050
````
5151

52-
## The field view context
52+
## The Field View Context
5353

54-
Field view components are passed a `FieldViewContext` object with the following information:
54+
Field view components are passed a `FieldViewContext` object with the following properties:
5555

5656
````csharp
5757
public class FieldViewContext
@@ -63,6 +63,6 @@ public class FieldViewContext
6363
}
6464
````
6565

66-
## Setting the field view of a list view field
66+
## Setting the Field View of a List View Field
6767

68-
A field view is assigned to a list view field as part of the list view configuration. For more information you can check the [List View Documentation](list-views.md#setting-the-view-of-a-field).
68+
A field view is assigned to a list view field as part of the list view configuration. For more information, see the [List Views](list-views.md#setting-the-view-of-a-field) article.
Lines changed: 89 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,159 @@
11
---
2-
description: Configuring the list view of a collection in Umbraco UI Builder, the backoffice UI builder for Umbraco.
2+
description: Configuring the list view of a collection in Umbraco UI Builder.
33
---
44

55
# List Views
66

7-
A list view is a list-based view of a collection entity providing features: pagination for large collections, custom data views, searching, and bulk actions.
7+
A list view displays a collection entity in a list format and includes features like pagination, custom data views, searching, and bulk actions.
88

99
![A collection list view](../images/listview.png)
1010

11-
## Configuring a list view
11+
## Configuring a List View
1212

13-
The list view configuration is a sub-configuration of a [`Collection`](the-basics.md) config builder instance and is accessed via its `ListView` method.
13+
The list view configuration is a sub-configuration of a [`Collection`](the-basics.md) config builder instance and can be accessed via the `ListView` method.
1414

15-
### **ListView(Lambda listViewConfig = null) : ListViewConfigBuilder&lt;TEntityType&gt;**
15+
### Using the `ListView()` Method
1616

17-
Accesses the list view config of the given collection.
17+
Accesses the list view configuration for the specified collection.
18+
19+
#### Method Syntax
20+
21+
```cs
22+
ListView(Lambda listViewConfig = null) : ListViewConfigBuilder<TEntityType>
23+
```
24+
25+
#### Example
1826

1927
````csharp
20-
// Example
2128
collectionConfig.ListView(listViewConfig => {
2229
...
2330
});
2431
````
2532

26-
## Adding a field to the list view
33+
## Adding a Field to the List View
34+
35+
### Using the `AddField()` Method
36+
37+
Adds a specified property to the list view.
38+
39+
#### Method Syntax
2740

28-
### **AddField(Lambda propertyExpression, Lambda fieldConfig = null) : ListViewFieldConfigBuilder&lt;TEntityType, TValueType&gt;**
41+
```cs
42+
AddField(Lambda propertyExpression, Lambda fieldConfig = null) : ListViewFieldConfigBuilder<TEntityType, TValueType>
43+
```
2944

30-
Adds the given property to the list view.
45+
#### Example
3146

3247
````csharp
33-
// Example
3448
listViewConfig.AddField(p => p.FirstName, fieldConfig => {
3549
...
3650
});
3751
````
3852

39-
## Changing the heading of a field
53+
## Changing the Heading of a Field
4054

41-
### **SetHeading(string heading) : ListViewFieldConfigBuilder&lt;TEntityType, TValueType&gt;**
55+
### Using the `SetHeading()` Method
4256

43-
Sets the heading for the list view field.
57+
Sets the heading for a field in the list view.
58+
59+
#### Method Syntax
60+
61+
```cs
62+
SetHeading(string heading) : ListViewFieldConfigBuilder<TEntityType, TValueType>
63+
```
64+
65+
#### Example
4466

4567
````csharp
46-
// Example
4768
fieldConfig.SetHeading("First Name");
4869
````
4970

50-
## Formatting the value of a field
71+
## Formatting the Value of a Field
72+
73+
### Using the `SetFormat()` Method
74+
75+
Sets the format expression to the field in the list view.
76+
77+
#### Method Syntax
5178

52-
### **SetFormat(Lambda formatExpression) : ListViewFieldConfigBuilder&lt;TEntityType, TValueType&gt;**
79+
```cs
80+
SetFormat(Lambda formatExpression) : ListViewFieldConfigBuilder<TEntityType, TValueType>
81+
```
5382

54-
Sets the format expression for the list view field.
83+
#### Example
5584

5685
````csharp
57-
// Example
5886
fieldConfig.SetFormat((v, p) => $"{v} years old");
5987
````
6088

61-
## Setting the view of a field
89+
## Setting the View of a Field
6290

63-
With field views, you can customize the markup the list view's field so you can show richer visualizations of the field's content. For more information you can check the [Field Views Documentation](field-views.md).
91+
You can customize the field's markup with field views, allowing richer visualizations of the content. For more details, see the [Field Views](field-views.md) article.
6492

65-
### **SetView(string viewComponentName) : ListViewFieldConfigBuilder&lt;TEntityType, TValueType&gt;**
93+
### Using the `SetView()` Method
6694

6795
Sets the view component for the list view field.
6896

97+
#### Method Syntax
98+
99+
```cs
100+
SetView(string viewComponentName) : ListViewFieldConfigBuilder<TEntityType, TValueType>
101+
```
102+
103+
#### Example
104+
69105
````csharp
70-
// Example
71106
fieldConfig.SetView("ImageFieldView");
72107
````
73108

74-
### **SetView&lt;TView&gt;() : ListViewFieldConfigBuilder&lt;TEntityType, TValueType&gt;**
109+
### Using the `SetView<TView>()` Method
75110

76111
Sets the view component for the list view field.
77112

113+
#### Method Syntax
114+
115+
```cs
116+
SetView<TView>() : ListViewFieldConfigBuilder<TEntityType, TValueType>
117+
```
118+
119+
#### Example
120+
78121
````csharp
79-
// Example
80122
fieldConfig.SetView<ImageFieldView>();
81123
````
82124

83-
## Setting the visibility of a field
125+
## Setting the Visibility of a Field
84126

85-
### **SetVisibility(Predicate&lt;ListViewFieldVisibilityContext&gt; visibilityExpression) : ListViewFieldConfigBuilder&lt;TEntityType, TValueType&gt;**
127+
### Using the `SetVisibility()` Method
86128

87-
Sets the runtime visibility of the list view field.
129+
Controls the runtime visibility of a field in the list view.
130+
131+
#### Method Syntax
132+
133+
```cs
134+
SetVisibility(Predicate<ListViewFieldVisibilityContext> visibilityExpression) : ListViewFieldConfigBuilder<TEntityType, TValueType>
135+
```
136+
137+
#### Example
88138

89139
````csharp
90-
// Example
91140
fieldConfig.SetVisibility(ctx => ctx.UserGroups.Any(x => x.Alias == "editor"));
92141
````
93142

94-
## Changing the page size
143+
## Changing the Page Size
144+
145+
### Using the `SetPageSize` Method
146+
147+
Sets the number of items per page for the list view.
148+
149+
#### Method Syntax
95150

96-
### **SetPageSize(int pageSize) : ListViewConfigBuilder&lt;TEntityType&gt;**
151+
```cs
152+
SetPageSize(int pageSize) : ListViewConfigBuilder<TEntityType>
153+
```
97154

98-
Sets the number of items to display per page for the given list view.
155+
#### Example
99156

100157
````csharp
101-
// Example
102158
listViewConfig.SetPageSize(20);
103159
````

0 commit comments

Comments
 (0)