We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Rerender ComboBox data (set dataSource to empty)

Thread ID:





150788 Jan 20,2020 08:52 AM UTC Jan 24,2020 06:36 AM UTC Angular - EJ 2 4
Tags: ComboBox
Asked On January 20, 2020 08:52 AM UTC


I am trying to set comboBox dataSource to empty array but I am still can see data that was rendered before my changes.

What am I doing:
On load I want to see one data in my comboBox. After value change in different comboBox I want to rerender data. Some times in cat be rerender to empty comboBox. I am doing in like this:
<ejs-combobox #ComboBox {someProperties}></ejs-combobox>
@ViewChild('ComboBox') MyComboBox: ComboBox;
public setDataSource() {
     if (this.data.length < 0)
          this.MyComboBox.dataSource = [];
          this.MyComboBox.dataSource = this.data;

If I set my dataSource to empty array - I see previuosly set values. If I set dataSource to some data - I see correct data. Maybe I am doing something wrong and must delete dataSource in some different way?

This is what data I am getting after setting dataSource to empty:

P.S. I am getting my data from WebAPI. I am using ej2-angular-dropdows version 17.1.49

Sevvandhi Nagulan [Syncfusion]
Replied On January 21, 2020 06:44 PM UTC

Hi AC, 

Greeting from Syncfusion support. 

We can able to reproduce the reported issue in our end. The cause of the issue is ulElement not updated property. You can set the value null to ulElement and list as mentioned in the below code snippet, 

        this.localObj.dataSource = []; 
        (this.localObj as any).ulElement = null; 
        (this.localObj as any).list = null; 

Please find the sample below, 

Sevvandhi N 

Replied On January 23, 2020 04:52 AM UTC


thank you for your answer. It works almost perfect but in some cases if I set my dataSource ant other stuff like in your example after using combobox destroy event I am getting an error (it looks like it is trying to hide popup event if it was not opened):

Replied On January 23, 2020 05:09 AM UTC

I fixed this issue by also setting listData property to null:
(this.localObj as any).listData = null;

Sureshkumar P [Syncfusion]
Replied On January 24, 2020 06:36 AM UTC

Hi AC, 
Sureshkumar P 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon