Skip to content
This repository has been archived by the owner on Dec 3, 2024. It is now read-only.

Typeahead component not updating value based on cascading parameter. #270

Open
JGSilverman opened this issue Apr 6, 2022 · 0 comments
Open

Comments

@JGSilverman
Copy link

JGSilverman commented Apr 6, 2022

I have a Blazored Typeahead component that has Value, ValueChanged, Value Expression. In my component, the value is bound to _currentData. I have a cascading param:

@if (_currentData != null)
{
<div>@_currentData.Name</div>
}

<BlazoredTypeahead MinimumLength="4"
                MaximumSuggestions="200"
                SearchMethod="@(Searchdata)"
                Value="@_currentData"
                ValueChanged="@((DataObj value) => HandleChanged(value))"
                ValueExpression="@(() => _currentData)"
                TValue="DataObj "
                TItem="DataObj "
                class="form-control"
                tabindex="0"
                Disabled=@_Disabled
                >

... more stuff for the templates...

 [CascadingParameter(Name = "CurrentData")]
 protected DataObj CurrentData{ get; set; } 

DataObj _currentData{ get; set; }

In On Params Set:

protected override async Task OnParametersSetAsync()
        {
            await base.OnParametersSetAsync();
            if (_currentData! = CurrentIlmast)
            {
                _currentData = CurrentIlmast;
                // should not be necessary?? await InvokeAsync(StateHasChanged);
            }
        }

When I receive data from the parent component's cascading value/param, the data comes through fine (as I can see the UI in my div above the typeahead get updated with the new vals from the cascading params), BUT the value of the typeahead isn't being updated in the input. Any help?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant