Blazored / Typeahead

Typeahead control for Blazor applications
https://blazored.github.io/Typeahead/
MIT License
439 stars 103 forks source link

[Bug] Selected value is not displayed #263

Closed nabrezzelt closed 2 years ago

nabrezzelt commented 2 years ago

Describe the bug After setting the Value-Property (click the button) the value is not displayed:

grafik

To Reproduce Steps to reproduce the behavior:

  1. Click the Test Button

Expected behavior The Value should be displayed after setting the Value-property manual.

Screenshots If applicable, add screenshots to help explain your problem.

Hosting Model:

Sample code:

<p>@_customer?.FullName</p>
<BlazoredTypeahead TValue="Customer"
                   TItem="Customer"
                   SearchMethod="@SearchCustomer"
                   @bind-Value="_customer"
                   Debounce="500">
    <SelectedTemplate>
        @context.FullName
    </SelectedTemplate>
    <ResultTemplate>
        @context.FullName
    </ResultTemplate>
    <NotFoundTemplate Context="_">
        No customer found.
    </NotFoundTemplate>
</BlazoredTypeahead>

<button @onclick="SetCustomer">test</button>

@code {
    private Customer _customer;

    private void SetCustomer()
    {
        _customer = new Customer();
    }

    private async Task<IEnumerable<Customer>> SearchCustomer(string s)
    {
        return await Task.FromResult(new List<Customer>());
    }

    private class Customer
    {
        public string FullName = "Mayer, Hans";
    }
}
djukic-marko commented 2 years ago

Hello there :) I beleve this is a duplicate of this issue. Try downgrading to 4.5.1...

benshemmeld commented 2 years ago

@nabrezzelt I have fixed this bug in this PR #278

nabrezzelt commented 2 years ago

Hi, thanks for investigating and solving the problem :). I will try it the next days.

And thanks @djukic-marko for the info about the rollback to 4.5.1