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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Save input values into suggestion list

Thread ID:





128854 Feb 13,2017 07:01 AM UTC Feb 15,2017 10:07 AM UTC Angular 3
Tags: ejAutoCompleteTextBox
Asked On February 13, 2017 07:01 AM UTC


I want to ask is there a possibility to add input values into autocomplete suggestion list (or maybe I need to use another component to do that)? I want to form autocomplete text box suggestion list from values that was inserted into text box (without using database). I don't need that values to save anywhere, because it must be used just in one users session. And I want to do that on some button click in interface or keyboard enter click.

For example:

I insert value 'ABC' and press keyboard enter button or interface button GO. I want that 'ABC' value and later another values appears in suggestion list where now there is 'No suggestions'. And after that if insert, for example, 'A', I want to see as a suggestion all values that was inserted before that contains letter 'A'.

Arun Palaniyandi [Syncfusion]
Replied On February 14, 2017 09:00 AM UTC

Hi Agne,   
Thanks for contacting Syncfusion Support.   
Query 1: ”I want to ask is there a possibility to add input values into autocomplete suggestion list (or maybe I need to use another component to do that)?”   
Yes, there is possibility to add the input values into the autocomplete suggestion list.    
To add our items to the Autocomplete suggestion, first we need to take the input values from the Autocomplete input text and then push that value to the Autocomplete data source to render in the suggestion list on button click.   
  onClick(event) { 
                var input = $('#myautocomplete').val(); 
                if (input.length > 0) { 
                    var obj = $("#myautocomplete").ejAutocomplete("instance");  
Query2: ”I want to see as a suggestion all values that was inserted before that contains letter 'A'.   
You can get all the values that were inserted so far that contain letter 'A' by setting the filterType property as “contains”.   
        <input type="text" id="myautocomplete" ej-autocomplete [dataSource]="dataList" [filterType]="filtervalue" watermarkText="Select a Car" 
               [highlightSearch]="true" [showPopupButton]="true" width="100%" /> 
          this.filtervalue= ej.filterType.Contains;  
We have also prepared a sample for your convenience below:   
You can also use allowAddNew property with Visual Mode. Refer to:   
If the provided sample does not meet your requirement, please give us more information that will help us to provide the solution at the earliest.    
Arun P.   

Replied On February 14, 2017 12:18 PM UTC


it is very helpful, exactly what I need! But I have one more problem.

Instead of class="ejinputtext" I want to use that input as ej-button like this:
            <input class="col-xs-2" ej-button id="myButton" [height]="searchByOthentComponent" (click)="onClick($event)" />
            <input type="text" id="myAutocomplete" ej-autocomplete [dataSource]="dataList" [filterType]="filtervalue" [highlightSearch]="true" [showPopupButton]="true" />

But there are the problem - when I click on button, the event onClick fires two times. How I need to prevent it from fireing second time?

Arun Palaniyandi [Syncfusion]
Replied On February 15, 2017 10:07 AM UTC

Hi Agne,  
Thanks for your update. 
We can reproduce the reported issue in our end. For Button control, initial click event raises from Angular due to native HTML input element tag. Latter click event triggers due to ejButton. We can identify origin of EJ event using “model” (event argument). So, please use the below code to prevent the “click” event triggering from Angular.   
<input ej-button id="myButton" [height]="searchByOthentComponent" (click)="onClick($event)" />   
onClick (event) {     
      if (! ej.isNullOrUndefined(event.model))      
        //your change event code.  //where event.model comprises of model values of ejButton   
        console.log ("Button Click Event Triggered.");            
        //event.model doesn’t present in the event raises from angular     
Please let us know if you have any queries. 
Arun 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