Filtering data in auto complete

2 posts, 0 answers
  1. Sameer
    Sameer avatar
    14 posts
    Member since:
    Mar 2012

    Posted 05 Oct 2012 Link to this post

    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.
  2. Burke
    Burke avatar
    41 posts
    Member since:
    Jun 2009

    Posted 03 Dec 2012 Link to this post

    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;
     
        }
      }
    });
  3. Kendo UI is VS 2017 Ready
Back to Top