How to put a column menu in toolbar of a kendo grid to select the columns as per need?
dataSource: $scope.kDisplayReceivedOrders,
toolbar: ["save", "cancel",
{
template:
'<button class="k-button k-button-icontext " ng-click="confirmReceivedOrder()" >Confirm</button>' +
'<button class="k-button " ng-click="printReceivedOrderDetails()">Print</button>'
}
],
You cannot insert the columnMenu froma a Kendo grid inside a toolbar because Kendo add it to the current grid.
But what you could do is a self implementation of the behavior of this menu inside your own toolbar. I have done it recently for a project.
What I have done:
.getOptions()
and then inspecting thecolumns
property of the object returned. The invisible columns will have ahidden=true
.hideColumn()
andshowColumn()
should be attached to the action of checking or unchecking a checkbox.Angular component controller:
A method to convert from kendo defaults to my visualization system:
The template: