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
close icon

Setting text focusOut Event

Hi 

I am using ej.ejAutocomplete control, it works good but I have a small problem.

If the user selects an item from suggestion popup list, I store the selected item in a local variable. 

The problem that I have is;
If the user removes a part of the text in autocompleteTextbox, I would like to set the text again on focusOut event, from tha local variable that I stored.

Here is the use case:
  1. User searches Departments
  2. Select "Development" Department from popup => selected item is saved in local variable on "select" event
  3. User deletes some text using backspace button and leave it like "Develo"
  4. OnFocusOut event, the text of textbox should be set to "Development" again (from selectedDepartment.name)

Thanks

3 Replies

NP Narayanasamy Panneer Selvam Syncfusion Team June 10, 2016 10:51 AM UTC

Hi Tolga,   
  
Thanks for Contacting Syncfusion support.  
    
We can achieve your requirement by using our existing events like “Select” and “focusOut” events and by declaring the variable as global, in which you want to store your selected value. Please refer the below code example.  
   
Code example:   
Global declaration:   
var store;   
    
$('#selectCar').ejAutocomplete({   
                     dataSource: carList,   
                  select: function (argument) {   
                    store =(argument.text);   
                },   
                focusOut: function (argument) {   
                    $("#selectCar").ejAutocomplete("selectValueByText", store);   
                }   
            });   
  
  
Please find the code sample in the below link.   
  
Regards,   
Narayanasamy P.   



TO Tolga June 15, 2016 07:27 AM UTC

Thanks.. it works..


NP Narayanasamy Panneer Selvam Syncfusion Team June 16, 2016 05:11 AM UTC

Hi Tolga, 
We are glad that the suggested solution worked for you.  
Let us know if need further assistance. 
Regards, 
Narayanasamy P. 


Loader.
Live Chat Icon For mobile
Up arrow icon