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

Filtering data in auto complete

1 Answer 190 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
Sameer
Top achievements
Rank 1
Sameer asked on 05 Oct 2012, 12:55 PM
Hi,

I am using auto complete for my search option. When data is entered in auto complete box it is filtered and data is shown but if i want to add another filter to it it is not working.
I am searching data from different categories based on dropdownlist.I want to add dropdown list data as the other filter.

Please help.

Regards,
Sam.

1 Answer, 1 is accepted

Sort by
0
Burke
Top achievements
Rank 1
answered on 03 Dec 2012, 05:55 PM
Hi Sameer!

What you should do is to add your extra filters to the filter array on the options object in the parameterMap on the DataSource for the AutoComplete.
$("#auto").kendoAutoComplete({
  dataSource: {
    transport: {
      read: "Home/Products"
    },
    parameterMap: (options, operation) {
 
      // get the text of the dropdown list
      var value = $("#dropdown").data("kendoDropDownList").text();
 
      // filter out whatever the value of the DropDown List is as well as
      // whatever the AutoComplete is already doing. 
      options.filter.filters.push({ field: "ProductName", operator: "neq", value: value, ignoreCase: true });
 
      return options;
 
    }
  }
});
Tags
AutoComplete
Asked by
Sameer
Top achievements
Rank 1
Answers by
Burke
Top achievements
Rank 1
Share this question
or