Hi,
I'm on Syncfusion.Blazor 18.2.0.44. and facing issue in binding data fetched during OnInitializedAsync(). This is my autocomplete section -
<div class="e-input-group">
<SfAutoComplete TValue="string" TItem="MyClass" FilterType="Syncfusion.Blazor.DropDowns.FilterType.StartsWith"
DataSource="@MyList">
<AutoCompleteFieldSettings Value="MyField"></AutoCompleteFieldSettings>
</SfAutoComplete>
</div>
And my class will have only a string, I'm doing this as SfAutoComplete doesn't bind to a List<string> directly.
public class MyClass
{
public string MyField { get; set; }
}
In my OnInitializeAsync if I invoke this method -
async Task GetValues()
{
var items = await myService.GetStuffAsync();
MyList = items.ToList().Select(x => new MyClass()
{
MyField = x
}).ToList();
}
I have entries in items but nothing gets bound and it keeps showing the empty dropdown. If I modify GetValues() to be synchronous, it is working fine.
void GetValues()
{
var items = myService.GetStuffSynchronously();
MyList = items.ToList().Select(x => new MyClass()
{
MyField = x
}).ToList();
}
Is there something being missed here? I do log the values obtained and I see the data source is just fine, does it need anything else to be triggered once the value is received into MyList?