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

How to update the data source, after calling external API using filtering event of autocomplete

Thread ID:





145962 Jul 16,2019 06:18 AM UTC Jul 22,2019 10:17 AM UTC Angular - EJ 2 5
Tags: AutoComplete
Asked On July 16, 2019 07:05 AM UTC


Problem:The data source(autoCompData) is not updating which is attached to autocomplete control ,after calling an external api call on event of filtering and updating data as below.

But the data-source is not updated with remote filtered data.

Why this:When drop down button is clicked ,showing no records,But on filtering showing pop up with data.

Thank you.

Prince Oliver [Syncfusion]
Replied On July 17, 2019 12:58 PM UTC

Hi Goutham 

Thank you for contacting us. 

We checked the share code snippet. It seems that you have initialized the dataSource as empty array([]) and then have assigned the some results to dataSource property in the filtering event. Hence during the initialization, when you click dropdown button the result is empty. The filtering event will trigger only when you start typing the characters in the input. So we suggest you assign the below code to actoComData at the initialization. 
public actoComData = this.SomeService.getFiltered(''); 
Let us know if you need any further assistance on this. 


Replied On July 17, 2019 03:21 PM UTC


But until i  search something ,no records are found that is ok at initial stage.After search i have records from result of API call.i am using event.updateData() method to update records,so that pop up opens and shows updated records,once i close popup and open it again with drop down click there is no records to show.

requirement:can i  load the records into autoCompData(which is initialized to dataSource of auto complete) after API call.i tried this way but not working.

Prince Oliver [Syncfusion]
Replied On July 19, 2019 04:32 AM UTC

Hi Goutham, 

Thank you for your update. 

We checked the reported scenario. To show the data again when you click the popup button, we suggest you set the result back to the autoCompData in the beforeOpen event. Please find the code snippet below, 

public onBeforeOpen(e) { 
    this.autoCompData = this.result; 

<ejs-autocomplete id='games' #sample [dataSource]='autoCompData' 
[placeholder]='waterMark' [fields]='fields'  (filtering)='onFiltering($event)' [showPopupButton] ="true" (beforeOpen)='onBeforeOpen($event)'></ejs-autocomplete> 

Let us know if you need any further assistance on this. 


Replied On July 19, 2019 09:37 AM UTC

Thank you,its working as expected.

Narayanasamy Panneer Selvam [Syncfusion]
Replied On July 22, 2019 10:17 AM UTC

Hi Goutham, 
Most welcome. we are glad that the issue is resolved in your end. 
Narayanasamy 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