Problem when selecting tags, it does not appear once selected

2 posts, 0 answers
  1. Kelly
    Kelly avatar
    2 posts
    Member since:
    Aug 2013

    Posted 01 Aug 2013 Link to this post

    input#autocomplete

    var tagTab=["oranges"];

    $("#autocomplete").kendoAutoComplete({

        dataSource: tagTab, 
        dataBound: function(e) {
             var dataSource = new kendo.data.DataSource({
                     data: [ "bananas", "cherries" ]
             });
             var autocomplete = $("#autocomplete").data("kendoAutoComplete");
             autocomplete.setDataSource(dataSource);
       }
    });

    This is my code, in fact as you can see here when the user start to write something, the tags will change from "oranges" to "bananas" and "cherries".
    Actually it's a simple exemple, the goal will be to change the tags in function of the imput text...

    Anyway, when you start to write "ba",  the autoComplete opens correctly, the tag is"bananas" like expected...

    My problem is:  When I select the tag (with arrow keys or mouse)  then I press enter (or click), just nothing append in the imput text field, the autoComplete just close.

    If someone could help me please, would be awesome ! 
  2. Kelly
    Kelly avatar
    2 posts
    Member since:
    Aug 2013

    Posted 01 Aug 2013 Link to this post

    Hello back,

    Finally I got a solution for this problem:

    input#autocomplete

    var tagTab=["oranges"];

    $("#autocomplete").kendoAutoComplete({
        dataSource: tagTab, 
        dataBound: function(e) {
             var dataSource = new kendo.data.DataSource({
                     data: [ "bananas", "cherries" ]
             });
             var autocomplete = $("#autocomplete").data("kendoAutoComplete");
             autocomplete.setDataSource(dataSource);
       },
       select: function(e) { 
             var item = e.item;
             var text = item.text();
             var autocomplete = $("#autocomplete").data("kendoAutoComplete");
             autocomplete.value(text);
       }
    });

    Hope that could be helpfull for you.

     
  3. Kendo UI is VS 2017 Ready
Back to Top