带有布尔下拉列表的KendoUI网格行过滤器

时间:2015-04-07 02:59:40

标签: javascript jquery kendo-ui kendo-grid kendo-dropdown

过滤器基本上工作正常,但是,

  • 选择似乎没有触发第一个选择
  • 每次重置过滤器时都会发生这种情况。

我现在干了两天......

这是Fiddle

<script src="../content/shared/js/products.js"></script>

<div id="grid"></div>

  <script>
    $(document).ready(function() {
      $("#grid").kendoGrid({
        dataSource: {
          data: products,
          schema: {
            model: {
              fields: {
                ProductName: { type: "string" },
                Discontinued: { type: "boolean" }
              }
            }
          },
          pageSize: 20
        },
        height: 550,
        scrollable: true,
        sortable: true,
        filterable: {
          mode: "row"
        },
        pageable: {
          input: true,
          numeric: false
        },
        columns: [
          {
            field: "ProductName",
            title: "Product Name",
            filterable: {
              cell: {
                operator: "contains",
                showOperators: false
              }
            }
          }, { 
            field: "Discontinued", title: "Discontinued",
            filterable: {
              mode: "row",
              cell: {
                showOperators: false,
                template: function (args) {
                  args.element.kendoDropDownList({
                    autoBind:false,
                    dataTextField: "text",
                    dataValueField: "value",
                    dataSource: new kendo.data.DataSource({
                      data: [{ text: "Yes", value: "true" }, 
                             { text: "No", value: "false" }]
                    }),
                    index: 0,
                    optionLabel: {
                      text: "Filter",
                      value: ""
                    },
                    valuePrimitive: true

                  })
                }
              }
            }
          }
        ]
      });
    });
  </script>

1 个答案:

答案 0 :(得分:3)

Kendo UI 2015 Q1上有很多bug,特别是在自动完成,多选,下拉等下拉列表系列小部件上。 将您的kendo库更改为2014或以前的版本将使其正常工作, 检查此dojo