Edit this page

clear

Resets the filter configurations and the dataSource to their initial state.

Example - reset the selected filter options

<div id="filter-menu">(age filter)</div>
<br />
<button>Clear filter</button>
<br />
<br />
<div id="grid"></div>
<script>
  var data = [
    { name: "Jane Doe", age: 30 },
    { name: "John Doe", age: 33 }
  ];

  var dataSource = new kendo.data.DataSource({
    data: data,
    schema: {
      model: {
        fields: {
          age: { type: "number" }
        }
      }
    },
    change: function(){
        console.log(5)
    }
  });

  $("#filter-menu").kendoFilterMenu({
    dataSource: dataSource,
    field: "age",
    operators: {
      number: {
        eq: "Equal to",
        neq: "Not equal to"
      }
    }
  });

  $("button").click(function(){
    $("#filter-menu").data('kendoFilterMenu').clear();
  });

  $("#grid").kendoGrid({
    columns: [
      { field: "name" },
      { field: "age", type: "number" }
    ],
    dataSource: dataSource
  });
</script>
Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy