Skip to content

Commit 372834d

Browse files
authored
ComboBoxDisableFilter (#261)
1 parent 5b21884 commit 372834d

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

CodeBeam.MudBlazor.Extensions/Components/ComboBox/MudComboBox.razor.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ public MudComboBox()
7070
[Category(CategoryTypes.FormComponent.Appearance)]
7171
[Parameter] public bool Editable { get; set; }
7272

73+
/// <summary>
74+
/// If true, all items are eligible regarding what user search in textfield. Default is false.
75+
/// </summary>
76+
[Category(CategoryTypes.FormComponent.Appearance)]
77+
[Parameter] public bool DisableFilter { get; set; } = false;
78+
7379
/// <summary>
7480
/// If true, searched text has highlight.
7581
/// </summary>

CodeBeam.MudBlazor.Extensions/Components/ComboBox/MudComboBoxItem.razor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ protected internal void CheckEligible()
153153

154154
protected bool IsEligible()
155155
{
156-
if (MudComboBox == null || MudComboBox.Editable == false)
156+
if (MudComboBox == null || MudComboBox.Editable == false || MudComboBox.DisableFilter == true)
157157
{
158158
return true;
159159
}

ComponentViewer.Docs/Pages/Examples/ComboboxExample7.razor

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<MudGrid>
55
<MudItem xs="12" sm="8" Class="d-flex gap-4 align-center justify-center">
66
<MudComboBox @bind-Value="@_value" @bind-Text="@_text" @bind-SelectedValues="@_selectedValues" Variant="Variant.Filled" Label="Highlighted" Editable="true" MultiSelection="@_multiselection"
7-
autocomplete="new-password" Color="_color" Clearable="_clearable" Strict="_strict" Highlight="true" HighlightClass="@(_customHighlightClass ? "mud-theme-primary" : null)">
7+
autocomplete="new-password" Color="_color" Clearable="_clearable" Strict="_strict" Highlight="true" HighlightClass="@(_customHighlightClass ? "mud-theme-primary" : null)" DisableFilter="_disableFilter">
88
<MudComboBoxItem Value="@("Foo")">Foo</MudComboBoxItem>
99
<MudComboBoxItem Value="@("Bar")">Bar</MudComboBoxItem>
1010
<MudComboBoxItem Value="@("Fizz")">Fizz</MudComboBoxItem>
@@ -16,7 +16,7 @@
1616
</MudComboBox>
1717

1818
<MudComboBox @bind-Value="@_value" @bind-Text="@_text" @bind-SelectedValues="@_selectedValues" Variant="Variant.Filled" Label="With NoItemsContent" Editable="true" MultiSelection="@_multiselection"
19-
autocomplete="new-password" Color="_color" Clearable="_clearable" Strict="_strict">
19+
autocomplete="new-password" Color="_color" Clearable="_clearable" Strict="_strict" DisableFilter="_disableFilter">
2020
<ChildContent>
2121
<MudComboBoxItem Value="@("Foo")">Foo</MudComboBoxItem>
2222
<MudComboBoxItem Value="@("Bar")">Bar</MudComboBoxItem>
@@ -41,6 +41,7 @@
4141
<MudSwitchM3 @bind-Checked="@_strict" Label="Strict" Color="Color.Secondary" />
4242
<MudSwitchM3 @bind-Checked="@_clearable" Label="Clearable" Color="Color.Secondary" />
4343
<MudSwitchM3 @bind-Checked="@_customHighlightClass" Label="Custom Highlight" Color="Color.Secondary" />
44+
<MudSwitchM3 @bind-Checked="@_disableFilter" Label="Disable Filter" Color="Color.Secondary" />
4445
</MudStack>
4546
</MudItem>
4647
</MudGrid>
@@ -56,6 +57,7 @@
5657
bool _clearable;
5758
bool _strict;
5859
bool _customHighlightClass;
60+
bool _disableFilter = false;
5961

6062
private string[] states =
6163
{

0 commit comments

Comments
 (0)