Skip to content

Commit a785209

Browse files
committed
Updated articles within the filtering section
1 parent 847b1e9 commit a785209

File tree

5 files changed

+152
-58
lines changed

5 files changed

+152
-58
lines changed
Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
2-
description: Configuring data views builders in Umbraco UI Builder, the backoffice UI builder for Umbraco.
2+
description: Learn how to configure data views builders in Umbraco UI Builder.
33
---
44

55
# Data Views Builders
66

7-
Data views builders allow you to create a collection data views list dynamically at run time. By default, Umbraco UI Builder will use the hard-coded data views defined in your Umbraco UI Builder config. However, if you need to build your data views list dynamically, then this is when you'd use a data views builder.
7+
Data views builders allow you to create a collection’s data views dynamically at runtime. By default, Umbraco UI Builder uses hard-coded data views from the configuration. However, if you need to generate data views dynamically, a data views builder is required.
88

9-
When Umbraco UI Builder resolves a data views builder it will attempt to do so from the global DI container. This means you can inject any dependencies that you require for your builder. If there is no type defined in the DI container, Umbraco UI Builder will fall-back to manually instantiating a new instance of value mapper.
9+
When resolving a data views builder, Umbraco UI Builder first attempts to retrieve it from the global Dependency Injection (DI) container. This allows injecting required dependencies into the builder. If no type is defined in the DI container, Umbraco UI Builder falls back to manually instantiating a new instance of the value mapper.
1010

11-
## Defining a data views builder
11+
## Defining a Data Views Builder
1212

13-
To define a data views builder you can create a class that inherits from the base class `DataViewsBuilder<TEntityType>` and implements the abstract methods.
13+
To define a data views builder, create a class that inherits from `DataViewsBuilder<TEntityType>` and implements the required abstract methods.
1414

1515
````csharp
1616
// Example
@@ -33,33 +33,54 @@ The required methods are:
3333
* **GetDataViews:** Returns the list of data views to choose from.
3434
* **GetDataViewWhereClause:** Returns the boolean **where clause** expression for the given data views alias.
3535

36-
## Setting the data views builder of a collection
36+
## Setting the Data Views Builder of a Collection
3737

38-
Setting a data views builder is controlled via the [collections](../collections/overview.md) configuration.
38+
Setting a data views builder is controlled via the [Collections](../collections/overview.md) settings.
3939

40-
### **SetDataViewsBuilder&lt;TDataViewsBuilder&gt;() : CollectionConfigBuilder&lt;TEntityType&gt;**
40+
### Using the `SetDataViewsBuilder()` Method
4141

42-
Sets the collections data views builder which allows you to define the data views dynamically at run time.
42+
Sets the collection's data views builder, allowing you to define data views dynamically at runtime.
43+
44+
#### Method Syntax
45+
46+
```cs
47+
SetDataViewsBuilder<TDataViewsBuilder>() : CollectionConfigBuilder<TEntityType>
48+
```
49+
50+
#### Example
4351

4452
````csharp
45-
// Example
4653
collectionConfig.SetDataViewsBuilder<PersonDataViewsBuilder>();
4754
````
4855

49-
### **SetDataViewsBuilder(Type dataViewsBuilderType) : CollectionConfigBuilder&lt;TEntityType&gt;**
56+
### Using the `SetDataViewsBuilder(Type)` Method
57+
58+
Sets the collection's data views builder, allowing you to define data views dynamically at runtime.
59+
60+
#### Method Syntax
5061

51-
Sets the collections data views builder which allows you to define the data views dynamically at run time.
62+
```cs
63+
SetDataViewsBuilder(Type dataViewsBuilderType) : CollectionConfigBuilder<TEntityType>
64+
```
65+
66+
#### Example
5267

5368
````csharp
54-
// Example
5569
collectionConfig.SetDataViewsBuilder(typeof(PersonDataViewsBuilder));
5670
````
5771

58-
### **SetDataViewsBuilder(DataViewsBuilder&lt;TEntityType&gt; dataViewsBuilder) : CollectionConfigBuilder&lt;TEntityType&gt;**
72+
### Using the `SetDataViewsBuilder(DataViewsBuilder<TEntityType>)` Method
73+
74+
Sets the collection's data views builder, allowing you to define data views dynamically at runtime.
5975

60-
Sets the collections data views builder which allows you to define the data views dynamically at run time.
76+
#### Method Syntax
77+
78+
```cs
79+
SetDataViewsBuilder(DataViewsBuilder<TEntityType> dataViewsBuilder) : CollectionConfigBuilder<TEntityType>
80+
```
81+
82+
#### Example
6183

6284
````csharp
63-
// Example
6485
collectionConfig.SetDataViewsBuilder(new PersonDataViewsBuilder());
6586
````
Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,45 @@
11
---
2-
description: Configuring data views in Umbraco UI Builder, the backoffice UI builder for Umbraco.
2+
description: Learn how to configure data views in Umbraco UI Builder.
33
---
44

55
# Data Views
66

7-
Data views allow you to define multiple, pre-filtered views of the same data source. This can be useful when entities exist in different states and you want a way to toggle between them.
7+
Data views allow you to define multiple pre-filtered views of the same data source. This is useful when entities exist in different states and you need a way to toggle between them.
88

99
![Data Views](../images/data_views.png)
1010

11-
## Defining data views
11+
## Defining Data Views
1212

13-
Data views are defined via the [collections](../collections/overview.md) configuration.
13+
Data views are defined via the [Collections](../collections/overview.md) settings.
1414

15-
### **AddDataView(string name, Lambda whereClauseExpression) : CollectionConfigBuilder&lt;TEntityType&gt;**
15+
### Using the `AddDataView()` Method
1616

17-
Adds a data view with the given name and **where clause** filter expression. Expression must be a `boolean` expression.
17+
Creates a data view with the specified name and a where clause filter expression. The expression must return a `boolean` value.
18+
19+
#### Method Syntax
20+
21+
```cs
22+
AddDataView(string name, Lambda whereClauseExpression) : CollectionConfigBuilder<TEntityType>
23+
```
24+
25+
#### Example
1826

1927
````csharp
20-
// Example
2128
collectionConfig.AddDataView("Active", p => p.IsActive);
2229
````
2330

24-
### **AddDataView(string group, string name, Lambda whereClauseExpression) : CollectionConfigBuilder&lt;TEntityType&gt;**
31+
### Using the `AddDataView()` Method with Group
32+
33+
Creates a data view within a specified group, using a where clause filter expression. The expression must return a `boolean` value.
34+
35+
#### Method Syntax
36+
37+
```cs
38+
AddDataView(string group, string name, Lambda whereClauseExpression) : CollectionConfigBuilder<TEntityType>
39+
```
2540

26-
Adds a data view with the given group, name and **where clause** filter expression. Expression must be a `boolean` expression.
41+
#### Example
2742

2843
````csharp
29-
// Example
3044
collectionConfig.AddDataView("Status", "Active", p => p.IsActive);
3145
````
Lines changed: 75 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,126 @@
11
---
2-
description: Configuring filterable properties in Umbraco UI Builder, the backoffice UI builder for Umbraco.
2+
description: Learn how to configure filterable properties in Umbraco UI Builder.
33
---
44

55
# Filterable Properties
66

7-
Umbraco UI Builder can dynamically build a filter dialog choosing appropriate editor views for you based on a basic property configuration. Properties of a number or date types will become range pickers and enums. Properties with options defined will become select/checkbox lists and all other properties will become text input filters.
7+
Umbraco UI Builder dynamically constructs a filter dialog by choosing appropriate editor views based on basic property configurations. Properties of numeric or date types become range pickers, enums become select/checkbox lists, and other properties are text input filters.
88

99
![Filterable Properties](../images/filterable_properties.png)
1010

11-
## Defining filterable properties
11+
## Defining Filterable Properties
1212

13-
Defining filterable properties is controlled via the [collections](../collections/overview.md) configuration.
13+
Defining filterable properties is controlled via the [Collections](../collections/overview.md) settings.
1414

15-
### **AddFilterableProperty(Lambda filterablePropertyExpression, Lambda filterConfig = null) : CollectionConfigBuilder&lt;TEntityType&gt;**
15+
### Using the `AddFilterableProperty()` Method
1616

17-
Adds the given property to the filterable properties collection.
17+
Adds a given property to the filterable properties collection.
18+
19+
#### Method Syntax
20+
21+
```cs
22+
AddFilterableProperty(Lambda filterablePropertyExpression, Lambda filterConfig = null) : CollectionConfigBuilder<TEntityType>
23+
```
24+
25+
#### Example
1826

1927
````csharp
20-
// Example
2128
collectionConfig.AddFilterableProperty(p => p.FirstName, filterConfig => filterConfig
2229
// ...
2330
);
2431
````
2532

26-
## Changing the label of a filterable property
33+
## Changing the Label of a Filterable Property
34+
35+
### Using the `SetLabel()` Method
36+
37+
Sets the label for the filterable property.
38+
39+
#### Method Syntax
2740

28-
### **SetLabel(string label) : FilterablePropertyConfigBuilder&lt;TEntityType, TValueType&gt;**
41+
```cs
42+
SetLabel(string label) : FilterablePropertyConfigBuilder<TEntityType, TValueType>
43+
```
44+
45+
#### Example
2946

3047
````csharp
31-
// Example
3248
filterConfig.SetLabel("First Name");
3349
````
3450

35-
## Adding a description to a filterable property
51+
## Adding a Description to a Filterable Property
52+
53+
### Using the `SetDescription()` Method
54+
55+
Sets a description for the filterable property.
3656

37-
### **SetDescription(string description) : FilterablePropertyConfigBuilder&lt;TEntityType, TValueType&gt;**
57+
#### Method Syntax
58+
59+
```cs
60+
SetDescription(string description) : FilterablePropertyConfigBuilder<TEntityType, TValueType>
61+
```
62+
63+
#### Example
3864

3965
````csharp
40-
// Example
4166
filterConfig.SetDescription("The first name of the person");
4267
````
4368

44-
## Defining basic options for a filterable property
69+
## Defining Basic Options for a Filterable Property
70+
71+
### Using the `SetOptions()` Method
4572

46-
### **SetOptions(IDictionary&lt;TValueType, string&gt; options) : FilterablePropertyConfigBuilder&lt;TEntityType, TValueType&gt;**
73+
Defines basic options for a filterable property.
74+
75+
#### Method Syntax
76+
77+
```cs
78+
SetOptions(IDictionary<TValueType, string> options) : FilterablePropertyConfigBuilder<TEntityType, TValueType>
79+
```
80+
81+
#### Example
4782

4883
````csharp
49-
// Example
5084
filterConfig.SetOptions(new Dictionary<string, string> {
5185
{ "Option1", "Option One" },
5286
{ "Option2", "Option Two" }
5387
});
5488
````
5589

56-
## Defining options with custom compare clauses for a filterable property
90+
## Defining Options with Custom Compare Clauses for a Filterable Property
91+
92+
### Using the `AddOption()` Method
93+
94+
Defines options with custom comparison clauses for a filterable property.
95+
96+
#### Method Syntax
5797

58-
### **AddOption(object key, string label, Lambda compareExpression) : FilterablePropertyConfigBuilder&lt;TEntityType, TValueType&gt;**
98+
```cs
99+
AddOption(object key, string label, Lambda compareExpression) : FilterablePropertyConfigBuilder<TEntityType, TValueType>
100+
```
101+
102+
#### Example
59103

60104
````csharp
61-
// Example
62105
filterConfig.AddOption("Option1", "Option One", (val) => val != "Option Two");
63106
````
64107

65-
## Configuring the mode of a filterable property
108+
## Configuring the Mode of a Filterable Property
109+
110+
For filterable properties with options, you can configure whether the options should allow multiple or single selections.
111+
112+
### Using the `SetMode()` Method
113+
114+
Configures the mode of a filterable property (multiple or single choice).
115+
116+
#### Method Syntax
66117

67-
For filterable properties with options you can configure whether the options should be multiple or single choice.
118+
```cs
119+
SetMode(FilterMode mode) : FilterablePropertyConfigBuilder<TEntityType, TValueType>
120+
```
68121

69-
### **SetMode(FilterMode mode) : FilterablePropertyConfigBuilder&lt;TEntityType, TValueType&gt;**
122+
#### Example
70123

71124
````csharp
72-
// Example
73125
filterConfig.SetMode(FilterMode.MultipleChoice);
74126
````
Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11
---
2-
description: Configuring a global filter in Umbraco UI Builder, the backoffice UI builder for Umbraco.
2+
description: Learn how to configure a global filter in Umbraco UI Builder.
33
---
44

55
# Global Filters
66

7-
If you want to work with a subset of data within a given collection then this is where the global filters come in handy. These allow you to define a filter to apply to all queries for a given collection.
7+
Use global filters to work with a specific subset of data within a collection. These filters apply to all queries for a given collection.
88

9-
## Applying a global filter
9+
## Applying a Global Filter
1010

11-
Applying a global filter is controlled via the [collections](../collections/overview.md) configuration.
11+
Configure global filters in the [Collections](../collections/overview.md) settings.
1212

13-
### **SetFilter(Lambda whereClauseExpression) : CollectionConfigBuilder&lt;TEntityType&gt;**
13+
### Using the `SetFilter()` Method
1414

15-
Sets the filter **where clause** expression. Expression must be a `boolean` expression.
15+
Defines a filter using a **where clause** expression. The expression must return a `boolean` value.
16+
17+
#### Method Syntax
18+
19+
```cs
20+
SetFilter(Lambda whereClauseExpression) : CollectionConfigBuilder<TEntityType>
21+
```
22+
23+
#### Example
1624

1725
````csharp
18-
// Example
1926
collectionConfig.SetFilter(p => p.Current);
2027
````

15/umbraco-ui-builder/filtering/overview.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
2-
description: Configuring filtering in Umbraco UI Builder, the backoffice UI builder for Umbraco.
2+
description: Learn how to configure filtering in Umbraco UI Builder.
33
---
44

55
# Filtering
66

7-
Beyond [searching](../searching/overview.md) there might be times when you need to be able to create specific views of a collection's data. To help with this Umbraco UI Builder has different filtering mechanisms available.
7+
In addition to [Searching](../searching/overview.md), you may need to create specific views of a collection's data. Umbraco UI Builder provides multiple filtering mechanisms to help with this.
88

99
![Filterable Properties](../images/filterable_properties.png)
1010

0 commit comments

Comments
 (0)