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.Grid
The widget instance which fired the event.
Example - subscribe to the "columnMenuInit" event during initialization
<div id="grid"></div>
<script>
$("#grid").kendoGrid({
columns: [
{ field: "name" },
{ field: "age" },
],
dataSource: [
{ name: "Jane Doe", age: 30},
{ name: "John Doe", age: 33}
],
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") {
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log("Custom button for", field);
}
});
}
});
</script>
Example - subscribe to the "columnMenuInit" event after initialization
<div id="grid"></div>
<script>
function grid_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") {
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log("Custom button for", field);
}
});
}
$("#grid").kendoGrid({
columns: [
{ field: "name" },
{ field: "age" },
],
dataSource: [
{ name: "Jane Doe", age: 30},
{ name: "John Doe", age: 33}
],
columnMenu: true
});
var grid = $("#grid").data("kendoGrid");
grid.bind("columnMenuInit", grid_columnMenuInit);
</script>