简体   繁体   中英

Kendo UI grid filtering via DropDownList instead of MultiSelect

The following snippet uses a MultiSelect field to filter through an array of items. Filtering only occurs when items have been selected in the MultiSelect and the 'Filter' button has been clicked. http://jsbin.com/iVIQoKiV/1/edit

How can it be set up using a DropDownList instead? Also, once an item has been selected in the DropDownList, how can the grid be filtered instantly without the need to click a button?

Edit:

Here's a new JSBin . Managed to implement a DropDownList. I've used the following change event but now filtering doesn't work:

change: function() {
  var value = dropdown.value();
  if (value) {
  grid.data("kendoGrid").dataSource.filter({
      field: "Territories",
      operator: function (itemValue) {
      var matchingItem = itemValue.find(function (item) {
        return $.inArray(item.TerritoryID, value) >= 0;
      });
        return matchingItem !== null;
      }
    });
  }

Hello just the same scenario is covered in the Toolbar Grid online demo here . It filters instantly beucase it uses the change event of the DropDownList to invoke the filter method immediately.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM