Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/Demo/Shared/Shared/DemoSearch.razor
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
ο»Ώ<FluentAutocomplete @ref="_searchAutocomplete"
TOption="NavItem"
Multiple="false"
Width="250px"
AutoComplete="off"
Placeholder="Type / to search..."
MaximumSelectedOptions="1"
OptionText="@(item => item.Title)"
@bind-ValueText="@_searchTerm"
@bind-SelectedOptions="_selectedOptions"
@bind-SelectedOptions:after="HandleSearchClicked"
@bind-SelectedOption="_selectedOption"
@bind-SelectedOption:after="HandleSearchClicked"
OnOptionsSearch="@HandleSearchInput"
ShowOverlayOnEmptyResults="false">
<OptionTemplate>
Expand Down
6 changes: 3 additions & 3 deletions examples/Demo/Shared/Shared/DemoSearch.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public partial class DemoSearch : IAsyncDisposable

private FluentAutocomplete<NavItem>? _searchAutocomplete = default!;
private string? _searchTerm = "";
private IEnumerable<NavItem>? _selectedOptions = [];
private NavItem? _selectedOption = null;

protected override void OnInitialized()
{
Expand Down Expand Up @@ -57,8 +57,8 @@ private void HandleSearchInput(OptionsSearchEventArgs<NavItem> e)
private void HandleSearchClicked()
{
_searchTerm = null;
var targetHref = _selectedOptions?.SingleOrDefault()?.Href;
_selectedOptions = [];
var targetHref = _selectedOption?.Href;
_selectedOption = null;
InvokeAsync(StateHasChanged);

// Ignore clearing the search bar
Expand Down
Loading