Tie Autocomplete to MultiSelect

2 posts, 0 answers
  1. Eric
    Eric avatar
    2 posts
    Member since:
    Jan 2014

    Posted 17 Oct Link to this post

    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?

  2. Nencho
    Admin
    Nencho avatar
    1671 posts

    Posted 19 Oct Link to this post

    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.
Back to Top