0
votes

I've got an AutoComplete widget bound to a datasource like so:

<input data-filter="contains" data-role="autocomplete" data-bind="source: styleData" data-text-field="style" id="style-name" />

I have the following items in the datasource:

  • ABC123
  • 123AC
  • ZZZ

When I type A into the AutoComplete box it automatically filters out the last item as expected. Then if I hit B, the second item is also filter out. If I then hit backspace, the second item reappears. With a final backspace however, the third item does not appear. $('#style-name').getKendoAutoComplete()'s value resolves to an empty string, but the dataSource's filter still has {field: 'style', logic: 'contains', value: 'A'} listed.

I've tested on Firefox 30 and IE11 on Windows 8.1 Update 1 and both give the same results.

2

2 Answers

1
votes

This is because

data-min-length="1"

This property only triggers the auto-complete when you have at least one character typed.

If you want to display all results without the 1 character minimum, then you are probably looking for a ComboBox.

0
votes

So I spent some time perusing the source and I guess this functionality is intended as indicated by the following lines from the search function (kendo.autocomplete.js, Q1 2014, line 301):

if (!length) {
    that.popup.close();
} else if (length >= that.options.minLength) {
    that._open = true;

    that._filterSource({
        value: ignoreCase ? word.toLowerCase() : word,
        operator: options.filter,
        field: options.dataTextField,
        ignoreCase: ignoreCase
    });
}

!length of 0 evaluates to true and closes the popup without changing the filter. I am going to move the _filterSource line outside of the conditional to solve the problem.