|
1 | 1 | --- |
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. |
3 | 3 | --- |
4 | 4 |
|
5 | 5 | # List Views |
6 | 6 |
|
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. |
8 | 8 |
|
9 | 9 |  |
10 | 10 |
|
11 | | -## Configuring a list view |
| 11 | +## Configuring a List View |
12 | 12 |
|
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. |
14 | 14 |
|
15 | | -### **ListView(Lambda listViewConfig = null) : ListViewConfigBuilder<TEntityType>** |
| 15 | +### Using the `ListView()` Method |
16 | 16 |
|
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 |
18 | 26 |
|
19 | 27 | ````csharp |
20 | | -// Example |
21 | 28 | collectionConfig.ListView(listViewConfig => { |
22 | 29 | ... |
23 | 30 | }); |
24 | 31 | ```` |
25 | 32 |
|
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 |
27 | 40 |
|
28 | | -### **AddField(Lambda propertyExpression, Lambda fieldConfig = null) : ListViewFieldConfigBuilder<TEntityType, TValueType>** |
| 41 | +```cs |
| 42 | +AddField(Lambda propertyExpression, Lambda fieldConfig = null) : ListViewFieldConfigBuilder<TEntityType, TValueType> |
| 43 | +``` |
29 | 44 |
|
30 | | -Adds the given property to the list view. |
| 45 | +#### Example |
31 | 46 |
|
32 | 47 | ````csharp |
33 | | -// Example |
34 | 48 | listViewConfig.AddField(p => p.FirstName, fieldConfig => { |
35 | 49 | ... |
36 | 50 | }); |
37 | 51 | ```` |
38 | 52 |
|
39 | | -## Changing the heading of a field |
| 53 | +## Changing the Heading of a Field |
40 | 54 |
|
41 | | -### **SetHeading(string heading) : ListViewFieldConfigBuilder<TEntityType, TValueType>** |
| 55 | +### Using the `SetHeading()` Method |
42 | 56 |
|
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 |
44 | 66 |
|
45 | 67 | ````csharp |
46 | | -// Example |
47 | 68 | fieldConfig.SetHeading("First Name"); |
48 | 69 | ```` |
49 | 70 |
|
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 |
51 | 78 |
|
52 | | -### **SetFormat(Lambda formatExpression) : ListViewFieldConfigBuilder<TEntityType, TValueType>** |
| 79 | +```cs |
| 80 | +SetFormat(Lambda formatExpression) : ListViewFieldConfigBuilder<TEntityType, TValueType> |
| 81 | +``` |
53 | 82 |
|
54 | | -Sets the format expression for the list view field. |
| 83 | +#### Example |
55 | 84 |
|
56 | 85 | ````csharp |
57 | | -// Example |
58 | 86 | fieldConfig.SetFormat((v, p) => $"{v} years old"); |
59 | 87 | ```` |
60 | 88 |
|
61 | | -## Setting the view of a field |
| 89 | +## Setting the View of a Field |
62 | 90 |
|
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. |
64 | 92 |
|
65 | | -### **SetView(string viewComponentName) : ListViewFieldConfigBuilder<TEntityType, TValueType>** |
| 93 | +### Using the `SetView()` Method |
66 | 94 |
|
67 | 95 | Sets the view component for the list view field. |
68 | 96 |
|
| 97 | +#### Method Syntax |
| 98 | + |
| 99 | +```cs |
| 100 | +SetView(string viewComponentName) : ListViewFieldConfigBuilder<TEntityType, TValueType> |
| 101 | +``` |
| 102 | + |
| 103 | +#### Example |
| 104 | + |
69 | 105 | ````csharp |
70 | | -// Example |
71 | 106 | fieldConfig.SetView("ImageFieldView"); |
72 | 107 | ```` |
73 | 108 |
|
74 | | -### **SetView<TView>() : ListViewFieldConfigBuilder<TEntityType, TValueType>** |
| 109 | +### Using the `SetView<TView>()` Method |
75 | 110 |
|
76 | 111 | Sets the view component for the list view field. |
77 | 112 |
|
| 113 | +#### Method Syntax |
| 114 | + |
| 115 | +```cs |
| 116 | +SetView<TView>() : ListViewFieldConfigBuilder<TEntityType, TValueType> |
| 117 | +``` |
| 118 | + |
| 119 | +#### Example |
| 120 | + |
78 | 121 | ````csharp |
79 | | -// Example |
80 | 122 | fieldConfig.SetView<ImageFieldView>(); |
81 | 123 | ```` |
82 | 124 |
|
83 | | -## Setting the visibility of a field |
| 125 | +## Setting the Visibility of a Field |
84 | 126 |
|
85 | | -### **SetVisibility(Predicate<ListViewFieldVisibilityContext> visibilityExpression) : ListViewFieldConfigBuilder<TEntityType, TValueType>** |
| 127 | +### Using the `SetVisibility()` Method |
86 | 128 |
|
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 |
88 | 138 |
|
89 | 139 | ````csharp |
90 | | -// Example |
91 | 140 | fieldConfig.SetVisibility(ctx => ctx.UserGroups.Any(x => x.Alias == "editor")); |
92 | 141 | ```` |
93 | 142 |
|
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 |
95 | 150 |
|
96 | | -### **SetPageSize(int pageSize) : ListViewConfigBuilder<TEntityType>** |
| 151 | +```cs |
| 152 | +SetPageSize(int pageSize) : ListViewConfigBuilder<TEntityType> |
| 153 | +``` |
97 | 154 |
|
98 | | -Sets the number of items to display per page for the given list view. |
| 155 | +#### Example |
99 | 156 |
|
100 | 157 | ````csharp |
101 | | -// Example |
102 | 158 | listViewConfig.SetPageSize(20); |
103 | 159 | ```` |
0 commit comments