Can't add new item to ComboBox during OnOpen Event if AllowFiltering is set to true

Hello

I am using OnOpen Event on ComboBox to add new Items before user sees list of entries.

But if AllowFiltering is set to "true", this does NOT work. ComboBox is never updated.


I have attached an Example.

Steps to reproduce:

  1. Start App
  2. Click on "Sample Site" on left side
  3. Click on FIRST ComboBox (AllowFiltering set to TRUE)
  4. Expected: Two items. Actual Result: Only one result.
  5. Reload Page.
  6. Click on SECOND ComboBox (AllowFiltering set to FALSE)
  7. Expected: Two items. Actual Result: Two items as expected!

Cheers
Lazar Gosic

2 Replies 1 reply marked as answer

LG Lazar Gosic August 25, 2021 04:06 PM UTC

Here's the example App


Attachment: BlazorSampleAppOnOpenExampleNew_c48b72f7.7z


PM Ponmani Murugaiyan Syncfusion Team August 26, 2021 03:55 PM UTC

Hi Lazar, 

Thanks for contacting Syncfusion support. 

We were able to reproduce the reported issue at our end and this issue has been occurred due to define the data source as List in the application. So, we suggest you to define the data source as ObservableCollection instead of List to reflect the data source with dynamically added value. Also, import the ObjectModel from collections for observable collection. Kindly refer the below code example 

@using System.Collections.ObjectModel;  
 
public class Games 
    { 
        public int? ID { get; set; } 
        public string Text { get; set; } 
    } 
    ObservableCollection<Games> LocalData = new ObservableCollection<Games> { 
        new Games() { ID= 1,Text= "American Football" }, 
    }; 


Please get back us if you need further assistance. 

Regards, 
Ponmani M 


Marked as answer
Loader.
Up arrow icon