KendoUI Grid row filter with dropdown for boolean

不想你离开。 提交于 2020-01-04 21:38:23

问题


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:


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



来源:https://stackoverflow.com/questions/29482969/kendoui-grid-row-filter-with-dropdown-for-boolean

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!