Is it possible (and if so how) to add an item to the column menu of a kendo UI grid?

So I have a grid and the columns have the good ol' column menu on them with the filtering/sorting/excluding of columns and it all works fine.

The fly in the ointment is that I would like to allow the user to rename a column heading and the obvious place in the UI to allow this is in said column menu.

Something like this:

(where the red bit is just another option that I click on and popup a little window to let me type in a new heading)

Is this possible and how would I do it?

I see that menus can be customized and the grid demo shows how to adjust the stuff in the filter popup but I am not sure how I would add this item (I can see how I would programmatically do the rename but just this getting an option onto the menu has me stumped).


You can use the columnMenuInit event. Two possibilities:

    dataSource: dataSource,
    columnMenu: true,
    columnMenuInit: function (e) {
        var menu = e.container.find(".k-menu").data("kendoMenu");
        var field = e.field;

        // Option 1: use the kendoMenu API ...
            text: "Rename"

        // Option 2: or create custom html and append manually ..
        var itemHtml = '<li id="my-id" class="k-item k-state-default" role="menuitem">' + 
                       '<span class="k-link"><b>Manual entry</b></span></li>';

        // add an event handler
        menu.bind("select", function (e) {
            var menuText = $(e.item).text();
            if (menuText == "Rename") {
                console.log("Rename for", field);
            } else if (menuText === "Manual entry") {
                console.log("Manual entry for", field);

See fiddle with two alternatives:

Need Your Help

Running the R console from Sublime Text 2

r sublimetext2

I am quite new with Sublime Text 2. I would like to write my script in ST2 and run/send it to the R console. I don't want to use SublimeREPL (most of the forums deal with this) because I want to ha...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.