【问题标题】:Kendo UI grid filtering via DropDownList instead of MultiSelectKendo UI 网格过滤通过 DropDownList 而不是 MultiSelect
【发布时间】:2014-01-22 09:58:48
【问题描述】:

下面的 sn-p 使用 MultiSelect 字段来过滤一组项目。仅当在 MultiSelect 中选择了项目并单击了“过滤器”按钮时,才会进行过滤。 http://jsbin.com/iVIQoKiV/1/edit

如何改为使用 DropDownList 进行设置?另外,一旦在 DropDownList 中选择了一个项目,如何在不需要单击按钮的情况下立即过滤网格?

编辑:

这是一个新的JSBin。管理实现一个 DropDownList。我使用了以下更改事件,但现在过滤不起作用:

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;
      }
    });
  }

【问题讨论】:

    标签: javascript jquery kendo-ui kendo-grid


    【解决方案1】:

    您好,Toolbar Grid 在线演示 here 涵盖了相同的场景。它会立即过滤,因为它使用 DropDownList 的更改事件来立即调用过滤器方法。

    【讨论】:

    • 设法使代码适应更改事件,但过滤现在不起作用。我已经在上面发布了更改代码。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-06
    • 2018-01-22
    相关资源
    最近更新 更多