Damien Huang Damien Huang - 21 days ago 7
Javascript Question

add an item in kendo grid column

I want to add an item in kendo grid's column menu to remove column.

(Success)1.Add an item.
(Success)2.Remove a column.
(Fail) 3.Close Menu after selecting.

I found that other kendo grid's column menu item will close menu after selecting.But my item won't close menu.

I have tried This(bind select event) And This(setOptions).
Could anyone give me a hand?

Answer

Using destroy() works.

menu.bind("select", function (select) {
    grid.hideColumn(field);
    this.destroy();
});

Demo #1

select:function (select) {
    var menuText = $(select.item).text();

    grid.hideColumn(field);
    this.destroy();
}

Demo #2