I want to provide the column menu option for columns only in one specific column of the kendo grid. Also, when the page loads I want to display one specific columns and hide the other columns. The user can select the other(hidden) columns from the column menu option which is provided in one of the columns.
I have done something like this to hide the column menu from certain columns:
<body>
<div id="example">
<div id="grid"></div>
<script>
$(document).ready(function () {
$("#grid").kendoGrid({
dataSource: {
type: "odata",
transport: {
read: "//demos.telerik.com/kendo-ui/service/Northwind.svc/Orders"
},
schema: {
model: {
fields: {
OrderID: { type: "number" },
ShipCountry: { type: "string" },
ShipName: { type: "string" },
ShipAddress: { type: "string" }
}
}
},
pageSize: 30,
serverPaging: true,
serverFiltering: true,
serverSorting: true
},
height: 550,
pageable: true,
columnMenu: true,
columns: [{
field: "OrderID",
title: "Order ID",
width: 120
}, {
field: "ShipCountry",
title: "Ship Country"
}, {
field: "ShipName",
title: "Ship Name"
}, {
field: "ShipAddress",
filterable: false
}
]
});
});
$(function(){
$('#grid .k-header-column-menu').eq(0).hide();
$('#grid .k-header-column-menu').eq(1).hide();
$('#grid .k-header-column-menu').eq(2).hide();
})
</script>
</div>
</body>
Is there a better method to achieve these two functionalities?