Welcome to the Blazor feedback portal. We’re happy you’re here! If you have feedback on how to improve the Blazor, we’d love to hear it!

  • Check out the features or bugs others have reported and vote on your favorites. Feedback will be prioritized based on popularity.
  • If you have feedback that’s not listed yet, submit your own.

Thanks for joining our community and helping improve Syncfusion products!

1
Vote

I am modifying the Cascading ComboBox to be able to pull in data from a Json File.

I have made modifications and am getting the data as expected, per other Syncfusion examples but the data will not load in the ComboBox.

Is there a bug or is something wrong? I am getting the data and have properly set the DataSource 

ComboBox Code: 

@ToDisplay 
<SfComboBox TValue="string" TItem="Country" Placeholder="Select a country" AllowCustom="false" PopupHeight="auto" DataSource="@CountryJsonAsync">
     <ComboBoxEvents TValue="string" TItem="Country" ValueChange="@ChangeCountry">
     <ComboBoxFieldSettings Text="CountryName.common" Value="CountryId">
<
/SfComboBox>

List, OnInitializedAsync that gets Json and loads into List:
(ToDisplay is just used as a variable to store and display the json data to validate the data retrieval works)

private static List CountryJsonAsync;
private string ToDisplay;
protected override async Task OnInitializedAsync() { 
      CountryJsonAsync = await HttpClient.GetFromJsonAsync<List<Country>>("https://localhost:44306/data/countries-na.json");
      ToDisplay = JsonSerializer.Serialize(CountryJsonAsync) + Environment.NewLine + Environment.NewLine;
      ToDisplay = ToDisplay + CountryJsonAsync[0].CountryName.common + "-" + CountryJsonAsync[0].CountryId + Environment.NewLine + Environment.NewLine;
      ToDisplay = ToDisplay + CountryJsonAsync[1].CountryName.common + "-" +  CountryJsonAsync[1].CountryId;
      StateHasChanged();
}

ToDisplay shows the the DataSource is getting set:  
[{"name":{"common":"Canada","official":"Canada"},"cca2":"CA"},{"name":{"common":"United States","official":"United States of America"},"cca2":"US"}]
Canada-CA United
States-US

What's missing? Everything that I see indicates this should work. Thanks