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

Problem when selecting tags, it does not appear once selected

1 Answer 38 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
Kelly
Top achievements
Rank 1
Kelly asked on 01 Aug 2013, 09:29 AM
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 ! 

1 Answer, 1 is accepted

Sort by
0
Kelly
Top achievements
Rank 1
answered on 01 Aug 2013, 11:49 AM
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.

 
Tags
AutoComplete
Asked by
Kelly
Top achievements
Rank 1
Answers by
Kelly
Top achievements
Rank 1
Share this question
or