|
1 | 1 | --- |
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. |
3 | 3 | --- |
4 | 4 |
|
5 | 5 | # Filterable Properties |
6 | 6 |
|
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. |
8 | 8 |
|
9 | 9 |  |
10 | 10 |
|
11 | | -## Defining filterable properties |
| 11 | +## Defining Filterable Properties |
12 | 12 |
|
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. |
14 | 14 |
|
15 | | -### **AddFilterableProperty(Lambda filterablePropertyExpression, Lambda filterConfig = null) : CollectionConfigBuilder<TEntityType>** |
| 15 | +### Using the `AddFilterableProperty()` Method |
16 | 16 |
|
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 |
18 | 26 |
|
19 | 27 | ````csharp |
20 | | -// Example |
21 | 28 | collectionConfig.AddFilterableProperty(p => p.FirstName, filterConfig => filterConfig |
22 | 29 | // ... |
23 | 30 | ); |
24 | 31 | ```` |
25 | 32 |
|
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 |
27 | 40 |
|
28 | | -### **SetLabel(string label) : FilterablePropertyConfigBuilder<TEntityType, TValueType>** |
| 41 | +```cs |
| 42 | +SetLabel(string label) : FilterablePropertyConfigBuilder<TEntityType, TValueType> |
| 43 | +``` |
| 44 | + |
| 45 | +#### Example |
29 | 46 |
|
30 | 47 | ````csharp |
31 | | -// Example |
32 | 48 | filterConfig.SetLabel("First Name"); |
33 | 49 | ```` |
34 | 50 |
|
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. |
36 | 56 |
|
37 | | -### **SetDescription(string description) : FilterablePropertyConfigBuilder<TEntityType, TValueType>** |
| 57 | +#### Method Syntax |
| 58 | + |
| 59 | +```cs |
| 60 | +SetDescription(string description) : FilterablePropertyConfigBuilder<TEntityType, TValueType> |
| 61 | +``` |
| 62 | + |
| 63 | +#### Example |
38 | 64 |
|
39 | 65 | ````csharp |
40 | | -// Example |
41 | 66 | filterConfig.SetDescription("The first name of the person"); |
42 | 67 | ```` |
43 | 68 |
|
44 | | -## Defining basic options for a filterable property |
| 69 | +## Defining Basic Options for a Filterable Property |
| 70 | + |
| 71 | +### Using the `SetOptions()` Method |
45 | 72 |
|
46 | | -### **SetOptions(IDictionary<TValueType, string> options) : FilterablePropertyConfigBuilder<TEntityType, TValueType>** |
| 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 |
47 | 82 |
|
48 | 83 | ````csharp |
49 | | -// Example |
50 | 84 | filterConfig.SetOptions(new Dictionary<string, string> { |
51 | 85 | { "Option1", "Option One" }, |
52 | 86 | { "Option2", "Option Two" } |
53 | 87 | }); |
54 | 88 | ```` |
55 | 89 |
|
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 |
57 | 97 |
|
58 | | -### **AddOption(object key, string label, Lambda compareExpression) : FilterablePropertyConfigBuilder<TEntityType, TValueType>** |
| 98 | +```cs |
| 99 | +AddOption(object key, string label, Lambda compareExpression) : FilterablePropertyConfigBuilder<TEntityType, TValueType> |
| 100 | +``` |
| 101 | + |
| 102 | +#### Example |
59 | 103 |
|
60 | 104 | ````csharp |
61 | | -// Example |
62 | 105 | filterConfig.AddOption("Option1", "Option One", (val) => val != "Option Two"); |
63 | 106 | ```` |
64 | 107 |
|
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 |
66 | 117 |
|
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 | +``` |
68 | 121 |
|
69 | | -### **SetMode(FilterMode mode) : FilterablePropertyConfigBuilder<TEntityType, TValueType>** |
| 122 | +#### Example |
70 | 123 |
|
71 | 124 | ````csharp |
72 | | -// Example |
73 | 125 | filterConfig.SetMode(FilterMode.MultipleChoice); |
74 | 126 | ```` |
0 commit comments