KendoUI Grid row filter with dropdown for boolean

2019-07-20 16:07发布

The Filter basically works fine but,

  • The select does not seem to fire the first selection
  • this happens every time the filter is reset as well.

I meddled with it for two days now...

here is the 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条回答
乱世女痞
2楼-- · 2019-07-20 16:35

Kendo UI 2015 Q1 has a lot of bug on it, especially on dropdown family widget like autocomplete, multiselect, dropdown, etc.. Change your kendo library to 2014 or previous version will make it works fine, check this dojo

查看更多
登录 后发表回答