[v2] Autocomplete Dropdown With Ajax-Data bug?


#1

Hello!
Interesting error in Kitchen-Sink.
If you fully manually enter string in the field ‘Autocomplete Dropdown With Ajax-Data’, for example J#, (or just focus on the input field with the value already selected) and select the same value from the drop-down list, then console is

     app.autocomplete.get('#autocomplete-dropdown-ajax-typeahead').value[0]
     undefined

but at the same time the console has ‘items’:

     app.autocomplete.get('#autocomplete-dropdown-ajax-typeahead').items[0]
     {id: 282, name: "J#"}

That is, if the ‘item’ you select matches the ‘value’ you set, and autocomplete object will undefined?
Why?

I use in my project Autocomplete dropdown with Ajax, but sometimes I can’t get the value.
I could use the ‘items’, but the string I want is not always in the first place.


#2

… is solved with using app.data on change event!

But I have a new problem:
how to get the keycode on key pressed Autocomplete?

          on: {
            keydown: function (e) {
                if (e.keyCode == 13) {
                  alert('Enter');
                }
              },

this way isn’t work


#3

Try to test if it may work

on: {

  pageInit: function (e, page) {

 $$(document).on(‘keydown’, ‘#id or .class’, function(e) {
   if(e.which === 13) {
        alert('Enter');
    }
  });

  },
},

#4

Thank You! It’s work