Combo Box Issue when Datasource is Emptied

Hi,
I am trying to clear the datasource from a combo box, but the second time i click to open the drop down, the previous data is displayed.

Steps to Reproduce

1) click the drop down icon - the popup is displayed with my four items
2) Click the "Clear" button
3) click the drop down icon - the popup is displayed and shows "not contents" (which is what I expect)
4) click on the drop down icon again to close the popup
5) click on the drop down icon again - popup opens, but with the original data


4 Replies 1 reply marked as answer

PG Pon Geetha A J Syncfusion Team October 19, 2020 11:41 AM UTC

To: Syncfusion Support <[email protected]>
Subject: Cant add code snippet to forum 
Hi, I am trying to add the following code snippet to my blazor forum post 158859. 
Can you please 
  • add the below code to the forum post
  • tell me the best way to post code in the forum to avoid having to contact support?
 
<SfComboBox DataSource="@vehicleTypes"  
            TValue="string" 
            TItem="VehicleTypeDto" 
            AllowFiltering=true 
            AllowCustom="false"> 
  <ComboBoxEvents TValue="string" 
                  TItem="VehicleTypeDto"> 
  </ComboBoxEvents> 
  <ComboBoxFieldSettings Value="VehicleType"></ComboBoxFieldSettings> 
</SfComboBox> 
 
<SfButton OnClick="@Click">Clear</SfButton> 
 
@code { 
  public ObservableCollection<VehicleTypeDto> vehicleTypes = new ObservableCollection<VehicleTypeDto>(); 
 
  private int _addCount = 0; 
 
  protected override async Task OnInitializedAsync() 
  { 
 
    Console.WriteLine("OnInitializedAsync"); 
    vehicleTypes.Add(new VehicleTypeDto() { Id = 1, VehicleType = "Prime Mover" }); 
    vehicleTypes.Add(new VehicleTypeDto() { Id = 2, VehicleType = "Rigid" }); 
    vehicleTypes.Add(new VehicleTypeDto() { Id = 3, VehicleType = "A Trailer" }); 
    vehicleTypes.Add(new VehicleTypeDto() { Id = 4, VehicleType = "B Trailer" }); 
 
    await base.OnInitializedAsync(); 
  } 
 
  public void Click() 
  { 
    vehicleTypes = new ObservableCollection<VehicleTypeDto>(); 
    StateHasChanged(); 
  } 
 
  public class VehicleTypeDto 
  { 
    public int Id { get; set; } 
    public string VehicleType { get; set; } 
  } 
} 



JM Jeyanth Muthu Pratheeban Sankara Subramanian Syncfusion Team October 21, 2020 05:17 PM UTC

Hi Jeremy, 
 
Greetings from Syncfusion support. 
 
We would like to thank you for spending your time to customize the sample and helping us to understand the issue much better. We have checked the reported issue and the same will occur if we enable the AllowFiltering property. We have already resolved this issue in the latest version of 18.3.42. So we suggest you to upgrade the Nuget packages to resolve the issue at your end. Please find the attached sample below . 
 
 
Regards, 
Jeyanth. 


Marked as answer

JE Jeremy October 22, 2020 10:57 AM UTC

Thanks, I have updated to the latest version and tested and can confirm that the functionality is working now.

Regards,
Jeremy


SP Sureshkumar P Syncfusion Team October 23, 2020 08:51 AM UTC

Hi Jeremy, 
 
Thanks for your update. 
 
Regards, 
Sureshkumar P 


Loader.
Up arrow icon