Edit this page

columnMenuInit

Fired when the column menu is initialized.

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 column menu form element.

e.field String

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

e.sender kendo.ui.TreeList

The widget instance which fired the event.

Example - subscribe to the "columnMenuInit" event during initialization

<div id="treeList"></div>
<script>
  $("#treeList").kendoTreeList({
    columns: [
      { field: "name" },
      { field: "age" }
    ],
    dataSource: {
      data: [
        { id: 1, parentId: null, name: "Jane Doe", age: 22 },
        { id: 2, parentId: 1, name: "John Doe", age: 24 }
      ]
    },
    columnMenu: true,
    columnMenuInit: function(e) {
      var menu = e.container.find(".k-menu").data("kendoMenu");
      var field = e.field;
      menu.append({ text: "Custom" });
      menu.bind("select", function(e) {
        if ($(e.item).text() == "Custom") {
          console.log("Custom button for", field);
        }
      });
    }
  });
</script>

Example - subscribe to the "columnMenuInit" event after initialization

<div id="treeList"></div>
<script>
  function treelist_columnMenuInit(e) {
    var menu = e.container.find(".k-menu").data("kendoMenu");
    var field = e.field;
    menu.append({ text: "Custom" });
    menu.bind("select", function(e) {
      if ($(e.item).text() == "Custom") {
        console.log("Custom button for", field);
      }
    });
  }

  $("#treeList").kendoTreeList({
    columns: [
      { field: "name" },
      { field: "age" }
    ],
    dataSource: {
      data: [
        { id: 1, parentId: null, name: "Jane Doe", age: 22 },
        { id: 2, parentId: 1, name: "John Doe", age: 24 }
      ]
    },
    columnMenu: true
  });

  var treelist = $("#treeList").data("kendoTreeList");
  treelist.bind("columnMenuInit", treelist_columnMenuInit);
</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