Hi there, I'm new to this component library, so I'm hoping this will be a simple fix.
I have a list of locations that I've been provided. From that list I need to have a dropdown that has a single entry for each ZipCode (Distinct) that my user can select.
I've setting Data=@MyDataFillMethod() and the dropdown show's grayed out. Based on a couple of reddit posts I've tried a slightly different method that seemed like it should work, but the result is the same.
Below is the code I'm currently calling in my OnInitializedAsync
private List<object> eligableZipCodes = new List<object>();
protected override Task OnParametersSetAsync()
{
eligableZipCodes.AddRange((ViewModel.GetEligableZipCodes().Select(l => new { Text = l, Value = l } )).ToList());
}
Then my component code looks like
<RadzenDropDown @ref=@radzenDropDown Data="@eligableZipCodes" @bind-Value="ViewModel.ZipCode" TextProperty="Text" ValueProperty="Value" />
That seems a bit hacky to me, and also doesnt work. I've even seen suggestion to call radzenDropDown.Reset()
after filling my List to notify the dropdown that something has changed, but radzenDropDown is always null.
Essentially I would like something along the lines of
<RadzenDropDown TValue="int?" Data="@ViewModel.GetEligableZipCodes()" @bind-Value="ViewModel.ZipCode" />
My service call that correctly returns my int collection is
public IEnumerable<int?> GetEligableZipCodes() => LocationData.DistinctBy(l => l.ZipCode).Select(l => l.ZipCode );