Samuel
Samuel

Reputation: 9993

KendoUI Grid row filter with dropdown for boolean

The Filter basically works fine but,

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>

Upvotes: 2

Views: 4868

Answers (1)

Dion D.
Dion D.

Reputation: 2596

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

Upvotes: 3

Related Questions