Edit this page

filterMenuInit

Fired when the grid filter menu is initialized, when it is opened for the first time.

The event handler function context (available via the this keyword) will be set to the widget instance.

Event Data

e.container jQuery

The jQuery object representing filter menu form element.

e.field String

The field of the column for which the filter menu is initialized.

e.sender kendo.ui.Grid

The widget instance which fired the event.

Example - subscribe to the "filterMenuInit" event during initialization and change the default operators

<div id="grid"></div>
<script>
$("#grid").kendoGrid({
  columns: [
    { field: "name" }
  ],
  dataSource: [
    { name: "Jane Doe"},
    { name: "John Doe"}
  ],
  filterable: true,
  filterMenuInit: function(e) {
    if (e.field == "name") {
      var firstValueDropDown = e.container.find("select:eq(0)").data("kendoDropDownList");
      firstValueDropDown.value("contains");
      firstValueDropDown.trigger("change");

      var logicDropDown = e.container.find("select:eq(1)").data("kendoDropDownList");
      logicDropDown.value("or");
      logicDropDown.trigger("change");

      var secondValueDropDown = e.container.find("select:eq(2)").data("kendoDropDownList");
      secondValueDropDown.value("contains");
      secondValueDropDown.trigger("change");
    }
  }
});
</script>

Example - subscribe to the "filterMenuInit" event after initialization

<div id="grid"></div>
<script>
function grid_filterMenuInit(e) {
  if (e.field == "name") {
    var firstValueDropDown = e.container.find("select:eq(0)").data("kendoDropDownList");
    firstValueDropDown.value("contains");
    var logicDropDown = e.container.find("select:eq(1)").data("kendoDropDownList");
    logicDropDown.value("or");
    var secondValueDropDown = e.container.find("select:eq(2)").data("kendoDropDownList");
    secondValueDropDown.value("contains");
  }
}
$("#grid").kendoGrid({
  columns: [
    { field: "name" }
  ],
  dataSource: [
    { name: "Jane Doe"},
    { name: "John Doe"}
  ],
  filterable: true
});
var grid = $("#grid").data("kendoGrid");
grid.bind("filterMenuInit", grid_filterMenuInit);
</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