columns.filterable.cell Object

Specifies options for the filter header cell when filter mode is set to 'row'.

Can be set to a JavaScript object which represents the filter cell configuration.

Example - cell filtering options

<div id="grid"></div>
<script>
$("#grid").kendoGrid({
  columns: [
    {
        field: "name",
        filterable: {
            cell: {
                enabled: true,
                delay: 1500
            }
        },
    },
    { field: "age" }
  ],
  filterable: {
      mode: "row"
  },
  dataSource: {
    data: [ { name: "Jane", age: 30 }, { name: "John", age: 33 }],
    schema:{
        model:{
            fields: {
                age: { type: "number" }
            }
        }
    }
  }
});
</script>

columns.filterable.cell.dataSource Object|kendo.data.DataSource

Specifies a custom dataSource for the AutoComplete when the type of the column is string. Can be a JavaScript object which represents a valid data source configuration, a JavaScript array, or an existing kendo.data.DataSource instance.

It is not recommended that you use the same dataSource instance for the Grid and the AutoComplete because it causes negative side effects.

If the dataSource options is missing, a new cloned instance of the Grid's dataSource will be used.

If the dataSource option is an existing kendo.data.DataSource instance, the widget will use that instance and will not initialize a new one.

Example - custom cell filter autocomplete dataSource

<div id="grid"></div>
<script>
$("#grid").kendoGrid({
  columns: [
    {
        field: "name",
        filterable: {
            cell: {
                dataSource: new kendo.data.DataSource({
                    data: [
                        { someField: "Jane" },
                        { someField: "Jake" },
                        { someField: "John" }
                    ]
                }),
                dataTextField: "someField"
            }
        }
    },
    { field: "age" }
  ],
  filterable: {
      mode: "row"
  },
  dataSource: {
    data: [ { name: "Jane", age: 30 }, { name: "John", age: 33 }],
    schema:{
        model:{
            fields: {
                age: { type: "number" }
            }
        }
    }
  }
});
</script>

columns.filterable.cell.dataTextField String

Specifies the name of the field which will provide the text representation for the AutoComplete suggestion (when using String type column) when CustomDataSource is provided. By default the name of the field bound to the column will be used.

Example - Using custom dataSource and providing dataTextField option

<div id="grid"></div>
<script>
      $("#grid").kendoGrid({
        columns: [
          {
              field: "name",
              filterable: {
                  cell: {
                      dataSource: new kendo.data.DataSource({ data: [
                          { someField: "Jane" },
                          { someField: "Jake" },
                          { someField: "John" }
                      ] }),
                      dataTextField: "someField"
                  }
              }
          },
          { field: "age" }
        ],
        filterable: { mode: "row" },
        dataSource: {
            data: [ { name: "Jane", age: 30 }, { name: "John", age: 33 }],
          schema:{
            model:{
                fields: {
                    age: { type: "number" }
                  }
              }
          }
        }
     });
</script>

columns.filterable.cell.delay Number (default: 200)

Specifies the delay of the AutoComplete widget which will provide the suggest functionality (when using String type column).

Example - Specifying delay option for the AutoComplete widget used to make suggestions while filtering.

<div id="grid"></div>
<script>
      $("#grid").kendoGrid({
          columns: [
            {
                field: "name",
                filterable: {
                    cell: {
                        delay: 1500
                    }
                }
            },
            { field: "age" } ],
        filterable: { mode: "row" },
        dataSource: {
            data: [ { name: "Jane", age: 30 }, { name: "John", age: 33 }],
          schema:{
            model:{
                fields: {
                    age: { type: "number" }
                  }
              }
          }
        }
      });
</script>

columns.filterable.cell.inputWidth Number

Specifies the width of the input before it is initialized or turned into a widget. Provides convenient way to set the width according to the column width.

Example - Specifying inputWidth option for the filter cell of a column

<div id="grid"></div>
<script>
      $("#grid").kendoGrid({
          columns: [
            {
                field: "name",
                filterable: {
                    cell: {
                        inputWidth: 333
                    }
                }
            },
            { field: "age" } ],
        filterable: { mode: "row" },
        dataSource: {
            data: [ { name: "Jane", age: 30 }, { name: "John", age: 33 }],
          schema:{
            model:{
                fields: {
                    age: { type: "number" }
                  }
              }
          }
        }
      });
</script>

columns.filterable.cell.suggestionOperator String (default: "startswith")

Specifies the AutoComplete filter option. The possible values are the same as the ones for the AutoComplete filter option - "startswith", "endswith", "contains". The "contains" operator performs a case-insensitive search. To perform a case-sensitive filtering, set a custom filtering function through the dataSource.filter.operator option.

This operator is completely independent from the operator used for the filtering on this column. For more inforamtion, check operator.

Example - Specifying suggestionOperator option for the filter cell of a column

<div id="grid"></div>
<script>
      $("#grid").kendoGrid({
          columns: [
            {
                field: "name",
                filterable: {
                    cell: {
                        suggestionOperator: "contains"
                    }
                }
            },
            { field: "age" } ],
        filterable: { mode: "row" },
        dataSource: {
            data: [ { name: "Jane", age: 30 }, { name: "John", age: 33 }],
          schema:{
            model:{
                fields: {
                    age: { type: "number" }
                  }
              }
          }
        }
      });
</script>

columns.filterable.cell.minLength Number (default: 1)

Specifies the minLength option of the AutoComplete widget when column is of type string.

Example - Specifying minLength of the AutoComplete widget when using filter cell.

<div id="grid"></div>
<script>
      $("#grid").kendoGrid({
          columns: [
            {
                field: "name",
                filterable: {
                    cell: {
                        minLength: 3
                    }
                }
            },
            { field: "age" } ],
        filterable: { mode: "row" },
        dataSource: {
            data: [ { name: "Jane", age: 30 }, { name: "John", age: 33 }],
          schema:{
            model:{
                fields: {
                    age: { type: "number" }
                  }
              }
          }
        }
        });
</script>

columns.filterable.cell.enabled Boolean (default: true)

When set to false the Grid will not render the cell filtering widget for that specific column.

Example - Disable the cell filtering for a specific column.

<div id="grid"></div>
<script>
      $("#grid").kendoGrid({
          columns: [
            {
                field: "name",
                filterable: {
                    cell: {
                        enabled: false
                    }
                }
            },
            { field: "age" } ],
        filterable: { mode: "row" },
        dataSource: {
            data: [ { name: "Jane", age: 30 }, { name: "John", age: 33 }],
          schema:{
            model:{
                fields: {
                    age: { type: "number" }
                  }
              }
          }
        }
      });
</script>

columns.filterable.cell.operator String (default: "eq")

Specifies the default operator that will be used for the cell filtering.

If you want to change how the AutoComplete suggestions are filtered use suggestionOperator.

Example - Specifying default operator for cell filtering.

<div id="grid"></div>
<script>
      $("#grid").kendoGrid({
          columns: [
            {
                field: "name",
                filterable: {
                    cell: {
                        operator: "neq"
                    }
                }
            },
            { field: "age" } ],
        filterable: { mode: "row" },
        dataSource: {
            data: [ { name: "Jane", age: 30 }, { name: "John", age: 33 }],
          schema:{
            model:{
                fields: {
                    age: { type: "number" },
                    name: {type: "string"}
                  }
              }
          }
        }
     });
</script>

columns.filterable.cell.showOperators Boolean (default: true)

Specifies whether to show or hide the DropDownList with the operators.

Example - Hide the operators dropdownlist for cell filtering.

<div id="grid"></div>
<script>
      $("#grid").kendoGrid({
          columns: [
            {
                field: "name",
                filterable: {
                    cell: {
                        showOperators: false,
                        operator: "contains"
                    }
                }
            },
            { field: "age" } ],
        filterable: { mode: "row" },
        dataSource: {
            data: [ { name: "Jane", age: 30 }, { name: "John", age: 33 }],
          schema:{
            model:{
                fields: {
                    age: { type: "number" }
                  }
              }
          }
        }
      });
</script>

columns.filterable.cell.template Function

JavaScript function which will customize how the input for the filter value is rendered. The function receives an object argument with two fields:

  • element - the default input inside the filter cell;
  • dataSource - a Kendo UI DataSource instance, which has the same settings as the Grid dataSource, but will only contain data items with unique values for the current column. This instance is also used by the default AutoComplete widget, which is used inside the filter cell if no template is set. Keep in mind that the passed dataSource instance may still not be populated at the time the template function is called, if the Grid uses remote binding.

Example - Using template for the filter cell

<div id="grid"></div>
<script>
      $("#grid").kendoGrid({
          columns: [
            {
                field: "color",
                filterable: {
                    cell: {
                        template: function (args) {
                            // create a DropDownList of unique values (colors)
                            args.element.kendoDropDownList({
                                dataSource: args.dataSource,
                                dataTextField: "color",
                                dataValueField: "color",
                                valuePrimitive: true
                            });

                            // or

                            // create a ColorPicker
                            // args.element.kendoColorPicker();
                        },
                        showOperators: false
                    }
                }
            },
            { field: "size" } ],
        filterable: { mode: "row" },
        dataSource: [ { color: "#ff0000", size: 30 }, { color: "#000000", size: 33 }] });
</script>

Example - use a Kendo UI DropDownList for a boolean column filter

<div id="grid"></div>
<script>
  $("#grid").kendoGrid({
    columns: [ "name", {
      field: "employed",
      filterable:{
        cell:{
          template:function(args){
            args.element.kendoDropDownList({
              dataSource: [{ value: true, text: "True" }, { value: false, text: "False" }],
              optionLabel: "--Select--",
              dataTextField: "text",
              dataValueField: "value"
            });
          }
        }
      }
    }],
    filterable: { mode: "row"},
    dataSource: {
      data:[{ name: "John Doe" , employed: true }, { name: "Jane Doe", employed: true }, { name: "Tim Doe", employed: false} ],
      schema:{
        model:{
          fields:{
            employed: { type: "boolean" }
          }
        }
      }
    }
  });
</script>
In this article