This is a migrated thread and some comments may be shown as answers.

Tie Autocomplete to MultiSelect

1 Answer 1616 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 17 Oct 2017, 05:52 PM

Hi

 

I want to add the results from an AutoComplete, into the Multiselect on the fly (ie as you select it in autocomplete, it adds it to multi-select)

Are there any examples of this?

1 Answer, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 19 Oct 2017, 10:55 AM
Hello Eric,

In order to achieve the desired functionality, you should first subscribe for the select event of the Autocomplete :

https://docs.telerik.com/kendo-ui/api/javascript/ui/autocomplete#events-select

In the above event, you can get the selected item text and use the dataSource of the multiselect to add new record with that text (using dataSoucre add method)

The implementation of this suggestion should look similar to the code snippet below:

select: function(e) {
   var item = e.item;
   var text = item.text();
    
   var data = multiselect.dataSource;
   data.add({text: text})
 }

In addition, below is a dojo example, demonstrating the behavior:

https://dojo.telerik.com/iGuNac/6

Regards,
Nencho
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
AutoComplete
Asked by
Eric
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Share this question
or