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

Kendo UI Autocomplete not working as expected

1 Answer 528 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 11 Feb 2015, 07:31 PM
I have run into an issue with the new version of Kendo UI that throws an exception when an autocomplete text box is manually deleted.  In the old version of Kendo, when you remove the input from the text box, no subsequent call is made to the server to retrieve new data.  The new versions, however, will make a call to the server with an empty string when the input is deleted which causes my application to get an error.  The behavior in the Kendo UI Dojo returns all the values when the input is deleted which seems incorrect.  I would think there would be no drop-down values if there is no input.  You can see the difference in behavior by performing the following:


Go to http://dojo.telerik.com/AyEfe

Select Kendo 2014 Q2 from the library drop-down.
Run
Type "che" in the input box - you will get a drop-down with the search results
Manually delete the input using backspace - the drop-down results go away

Now select Kendo 2014 Q3 SP2 from the library drop-down.
Run
Type "che" in the input box - you will get a drop-down with the search results
Manually delete the input using backspace - the drop-down lists all the values

I think the Q3 SP2 version has a bug since a blank input should return no drop-down data.  Is this accurate or is this by design?  Should I log a bug for this issue?

1 Answer, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 13 Feb 2015, 09:19 AM
Hello,

Indeed we introduced a change in the AutoComplete behavior that is related to #241.  We decided to implement it because it was quite desired feature and this behavior is consistent with the ComboBox widget.
I completely understand that such change might conflict with your application logic so I would suggest the following workaround:
Subscribe for the AutoComplete filtering event and stop the filtering if the input is empty string:
//code
function onFiltering(e) {
    if (!e.filter.value) {
        e.preventDefault();
    }
}



Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
AutoComplete
Asked by
Steve
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Share this question
or