Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disabling column menu for specific column in Kendo UI Grid

Tags:

c#

kendo-ui

Is it possible to disable column menu for specific column in Kendo UI Grid? And if it is, how it should be done?

like image 658
kul_mi Avatar asked Nov 28 '12 12:11

kul_mi


People also ask

How do I fix a column in Kendo grid?

The Kendo UI grid widget supports static/frozen columns by a single configuration setting. Simply set the locked attribute of the corresponding column to true, and this will bring the column in the locked columns group positioned on the left in the grid.

What is Pageable in kendo grid?

kendo:grid-pageable-messagesThe text messages displayed in pager. Use this option to customize or localize the pager messages.

What is Dataitem in kendo grid?

Returns the data item to which the specified table row is bound. The data item is a Kendo UI Model instance.

How do I turn off the filter on my Kendo grid?

In order to remove the current filters, apply an empty object as a filter to the DataSource. To remove only a specific filter from the Grid DataSource, the filter object needs to be removed from the filters array.


2 Answers

Out of the box you can only exclude the column from being shown/hidden through the column menu (i.e. there wont be a checkbox defined for that column which you can check/uncheck). To do so you should use the menu option when defining your column. e.g.

    jQuery("#Grid").kendoGrid({
    "columns": [{
        "title": "Person ID",
        "menu": false, //this way
        "field": "PersonID" 
    },
    {
        "field": "Name",
        "encoded": true
    },
    //...

If you want you completely hide the column menu for lets say the 3rd column you can use the following work-around:

$(function(){
     $('#GridName .k-header-column-menu').eq(2).hide()
})
like image 65
Petur Subev Avatar answered Sep 24 '22 05:09

Petur Subev


You can use this in MVC when defining the columns. Sample code is as as below.

columns.Bound(person => person.FirstName).IncludeInMenu(false);

like image 25
user3562861 Avatar answered Sep 24 '22 05:09

user3562861