Typeahead
Typeahead copied to clipboard
Typeahead component not updating value based on cascading parameter.
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?