Skip to content

Commit 914a057

Browse files
docs(multiSelect): filtering
1 parent 3a80142 commit 914a057

File tree

1 file changed

+38
-14
lines changed

1 file changed

+38
-14
lines changed

components/multiselect/filter.md

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,36 @@ position: 3
1010

1111
# MultiSelect Filter
1212

13-
The AutoComplete component can filter the available suggestions according to the current user input, so they can find the one they need faster. To see the difference in behavior, visit the [Live Demo: AutoComplete Filtering](https://demos.telerik.com/blazor-ui/autocomplete/filtering) page.
13+
The MultiSelect component can filter the available suggestions according to the current user input, so they can find the one they need faster. To see the difference in behavior, visit the [Live Demo: MultiSelect Filtering](https://demos.telerik.com/blazor-ui/multiselect/filtering) page.
1414

1515
To enable filtering, set the `Filterable` parameter to `true`.
1616

1717
Filtering ignores casing and the default filter operator is `starts with`. You can choose a different operator through the `FilterOperator` parameter that takes a member of the `Telerik.Blazor.StringFilterOperator` enum.
1818

1919
To control when the filter list appears, set the `MinLength` parameter. This can be useful if you have a very large list of data.
2020

21-
You can also implement custom filtering and set a data source dynamically through the [`OnRead` event]({%slug autocomplete-events%}#onread).
21+
You can also implement custom filtering and set a data source dynamically through the [`OnRead` event]({%slug multiselect-events%}#onread).
2222

23-
>caption Filtering in the AutoComplete
23+
>caption Filtering in the MultiSelect
2424
2525
````CSHTML
2626
@* as you type "de", you will only get "Developer" and "Designer" as suggestions instead of the full list *@
2727
28-
<TelerikAutoComplete Data="@Suggestions" @bind-Value="@TheValue"
28+
<TelerikMultiSelect Data="@Roles" @bind-Value="@TheValues"
2929
Filterable="true"
3030
Placeholder="Write 'de' to see the filtering" ClearButton="true" />
3131
32+
<ul>
33+
@foreach (var item in TheValues)
34+
{
35+
<li>@item</li>
36+
}
37+
</ul>
38+
3239
@code{
33-
string TheValue { get; set; }
40+
List<string> TheValues { get; set; } = new List<string>();
3441
35-
List<string> Suggestions { get; set; } = new List<string> {
42+
List<string> Roles { get; set; } = new List<string> {
3643
"Manager", "Developer", "QA", "Technical Writer", "Support Engineer", "Sales Agent", "Architect", "Designer"
3744
};
3845
}
@@ -43,14 +50,21 @@ You can also implement custom filtering and set a data source dynamically throug
4350
````CSHTML
4451
@* On the first keystroke, there will be no suggestions, then you will only get "Developer" and "Designer" as you write "de" *@
4552
46-
<TelerikAutoComplete Data="@Suggestions" @bind-Value="@TheValue"
53+
<TelerikMultiSelect Data="@Roles" @bind-Value="@TheValues"
4754
Filterable="true" MinLength="2"
4855
Placeholder="Write 'de' to see the filtering" ClearButton="true" />
4956
57+
<ul>
58+
@foreach (var item in TheValues)
59+
{
60+
<li>@item</li>
61+
}
62+
</ul>
63+
5064
@code{
51-
string TheValue { get; set; }
65+
List<string> TheValues { get; set; } = new List<string>();
5266
53-
List<string> Suggestions { get; set; } = new List<string> {
67+
List<string> Roles { get; set; } = new List<string> {
5468
"Manager", "Developer", "QA", "Technical Writer", "Support Engineer", "Sales Agent", "Architect", "Designer"
5569
};
5670
}
@@ -64,29 +78,39 @@ You can also implement custom filtering and set a data source dynamically throug
6478
6579
<label>
6680
Choose filter operator:
67-
<select @bind="filterOperator">
81+
<select @bind="@filterOperator">
6882
@foreach (var possibleFilter in Enum.GetValues(typeof(StringFilterOperator)))
6983
{
7084
<option value="@possibleFilter">@possibleFilter</option>
7185
}
7286
</select>
7387
</label>
74-
<TelerikAutoComplete Data="@Suggestions" @bind-Value="@TheValue"
88+
89+
<TelerikMultiSelect Data="@Roles" @bind-Value="@TheValues"
7590
Filterable="true" FilterOperator="@filterOperator"
7691
Placeholder="Write 's' or 'a' to see the difference" ClearButton="true" />
7792
93+
<ul>
94+
@foreach (var item in TheValues)
95+
{
96+
<li>@item</li>
97+
}
98+
</ul>
99+
78100
@code{
79-
string TheValue { get; set; }
101+
List<string> TheValues { get; set; } = new List<string>();
102+
80103
StringFilterOperator filterOperator { get; set; } = StringFilterOperator.StartsWith;
81104
82-
List<string> Suggestions { get; set; } = new List<string> {
105+
List<string> Roles { get; set; } = new List<string> {
83106
"Manager", "Developer", "QA", "Technical Writer", "Support Engineer", "Sales Agent", "Architect", "Designer"
84107
};
85108
}
109+
86110
````
87111

88112
## See Also
89113

90-
* [Live Demo: AutoComplete Filtering](https://demos.telerik.com/blazor-ui/autocomplete/filtering)
114+
* [Live Demo: MultiSelect Filtering](https://demos.telerik.com/blazor-ui/multiselect/filtering)
91115

92116

0 commit comments

Comments
 (0)