Click here to Skip to main content
15,891,725 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Based on the picture on below link:

IMAGE

I want columns to be able to be chosen expect the first one : IsSelected (that its title is "Is Selected")

Thank you so much!

What I have tried:

I tried to do it by javascript by I couldn't find the element to hide it.
Posted
Updated 4-Jul-16 0:54am

There is no built-in support for that...
The only option I know of is to change the menu from the columnMenuInit event of the grid...
Configuration, methods and events of Kendo UI Grid[^]

UPDATE
While all I wrote is right - based on the official documentation, there is a - totally undocumented - feature, that I found while browsing the code...
When defining the column add "menu" attribute with value false...
JavaScript
columns: [
  { field: "name", "menu": false },
  { field: "age" },
],

(It seems that this option was added from the MVC wrapper, but never documented on the basic Kendo UI package, however seems to be safe to use as long as it exists in the wrapper)
 
Share this answer
 
v2
Comments
bahman.01 4-Jul-16 6:11am    
@Kornfeld Eliyahu Peter
How to reset the columnMenuInit after the creation of the grid?
Kornfeld Eliyahu Peter 4-Jul-16 6:15am    
Have you read the sample?
Subscribe tot he event and grab the menu, than change it!
Something like this:
$("#grid").kendoGrid({
columnMenu: true,
columnMenuInit: function(e) {
var menu = e.container.find(".k-menu").data("kendoMenu");

menu.remove("#itemid-to-remove");
}
Member 11186239 4-Dec-16 14:51pm    
This works fine the FIRST time you want to open a menu for a column. You can set the text of your menu items to be exactly how you want.

But in our case sometimes the text of a menu item will change during the lifetime of the session (e.g. 'Turn On X' if its off, but 'Turn Off X' if its subsequently been turned on).

How can you force this event to refire so it shows the correct menu text each time and not just the first time?
bahman.01 4-Jul-16 6:38am    
I did this code but after it the width size of each column will be set very thin and I don't know why. and still nothing has been change on the grid.
bahman.01 4-Jul-16 6:43am    
The problem is I must define the gird with all features in javascript again while I have about 50 pages and each page contains about 40 columns.
C#
columns.Bound(p => p.IsSelected)
        .Width(50)
        .IncludeInMenu(false);


We must work with "IncludeInMenu" and set to false If we don't want it to be shown in column menu and true and showing.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900