Autocomplete how to detect cancel editing

Posted by: r.limanowski on 29 January 2018, 12:48 am EST

    • Post Options:
    • Link

    Posted 29 January 2018, 12:48 am EST

    Hi,

    I try to use autocomplete in a form.

    When I start to search in the autocomplete and DO NOT select a value from the

    dropdown list, ie. cancel the update process I would like to restore the text

    in the autocomplete.

    How can I know that editing has been cancelled?

    Regards

  • Posted 29 January 2018, 1:07 am EST

    Hi,

    I am sorry but I am unable to understand your use case. In my case when I do not select a value from the dropdown list the typed characters remain on the Auto Complete Input Box. They are replaced only when I select a value from the DropDown.

    Could you please elaborate your requirements.

  • Posted 29 January 2018, 2:38 am EST

    Hi,

    I would like to restore the text in the ac input box to the state

    it was before I started new autocomplete sequence

    in the case I do not select a value from the dropdown list.

    For this I need to know that ac search is finished and I

    did not selected a value.

    How to achieve this?

  • Posted 31 January 2018, 9:06 pm EST

    You can use the isDroppedDownChanged changed event for the purpose and save the previous value.

    <wj-auto-complete #ac [itemsSource]="countries"
                                       [isRequired]="false"
                                       [placeholder]="'(country)'" (isDroppedDownChanged)="dropDownChanged(ac,$event)"></wj-auto-complete>
    
       dropDownChanged(s: wjcInput.AutoComplete, e: wjcCore.EventArgs) {
                
                 this.tempitem = s.selectedItem;
               
                     if (s.isDroppedDown == false)
                     {
                         if (s.selectedIndex == -1)
                         {
                             s.text =this.selectedtextTemp;
                         }
    
                         this.selectedtextTemp  = s.text;
                     }
                   
                 
            }
    
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels