How to add ejAutocomplete at runtime?

I want that datasource of autocomplete box changes after any key entered in textbox. currently i am pre populating the datasource but is there any way that each time user enters anything it go to the database and come up with new data?

1 Reply

SS Selvamani Sankarappan Syncfusion Team May 21, 2018 11:51 AM UTC

Hi Raj Kumar, 
 
Thanks for contacting Syncfusion support. 
 
Yes, you can change the autocomplete dataSource at dynamically using instance of object. Also, you can trigger the change event while entering the any text in Autocomplete. Please refer to the following code example: 
 
function onChange(args) { 
        var obj = $('#autocomplete').ejAutocomplete("instance"); 
        obj.option("dataSource", mobileList); // pass the dataSource which you want 
} 
 
Please refer to the following sample demo: 
 
Please refer to the following API link: 
 
Please let us know if you need any further assistance. 
 
Regards, 
 
Selvamani S. 


Loader.
Up arrow icon