Tag Archives: autocompletebox

Kendo autocomplete box and server filtering

Standard

Hello all,
A very simple thought today but as it took me some time to figure it out, I thought that little post could make you spare some.

I used the autocomplete box from kendo UI bound with a remote datasource. Based on the user input, server returned a set of matching words, processing quotes for example for a google-like exact search. But the autocomplete box kept filtering client-side too, looking for quotes in the results set and filtering all my server results…. I finally figured out that setting “serverFiltering = true” on the datasource itself stopped the client-side filtering !
Happy coding !

var dataSource = new kendo.data.DataSource({
      transport: {
         read: { url : "http....",
        },
      success: function (response) {
         o.success(response);
       }
 },
 serverFiltering: true, //set it to true to stop client-side filtering
 total: 5, //five results only
 optionLabel: "Type in a...",
 });

myAutoComplete.kendoAutoComplete({
 dataSource: dataSource,
 dataTextField: "toto",
 dataValueField: "titi",
 …
 )} ;
Advertisements