# Angular Data Grid Column Menu

The [Angular Grid](https://www.telerik.com/kendo-angular-ui-develop/components/grid) enables you to show a menu with quick actions for its columns.

The column menu provides a convenient way to apply data processing features to the specified columns. The user can sort and filter the grid data, toggle the locked and sticky state of the columns, or change their visibility. You can customize the order of the menu items and create custom controls as necessary.

To display the column menu on each column, set the [`columnMenu`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/gridcomponent#columnmenu) option of the Grid. The property accepts both `boolean` and [`ColumnMenuSettings`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columnmenusettings) parameters. The default value of the `columnMenu` option is `false`.

The following example demonstrates a basic column menu in action.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/grid/column-menu/basic/source.txt)

## Configuring the Column Menu

To specify which items to appear in the column menu, pass a [`ColumnMenuSettings`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columnmenusettings) parameter object to the [`columnMenu`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/gridcomponent#columnmenu) option.

The available predefined column menu items are:

* [View](https://www.telerik.com/kendo-angular-ui-develop/components/grid/accessories/column-menu#column-menu-layout)—Displays the column menu items as a `list` or in a `tabbed` view. Defaults to `list`.
* [Sort item](https://www.telerik.com/kendo-angular-ui-develop/components/grid/accessories/column-menu#sort-item)—Displays **Sort Ascending** and **Sort Descending** buttons, which apply the corresponding sorting to the current column. If the Grid is [`sortable`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/gridcomponent#sortable), this option defaults to `true` for model-bound columns.
* [Filter item](https://www.telerik.com/kendo-angular-ui-develop/components/grid/accessories/column-menu#filter-item)—Displays a **Filter** button and an expandable filter menu. If the Grid is [`filterable`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/gridcomponent#filterable), this option defaults to `true` for model-bound columns.
* [Lock and unlock items](https://www.telerik.com/kendo-angular-ui-develop/components/grid/accessories/column-menu#lock-and-unlock-items)—Determines if the users can lock and unlock the column through the column menu. Defaults to `false`.
* [Stick and unstick items](https://www.telerik.com/kendo-angular-ui-develop/components/grid/accessories/column-menu#stick-and-unstick-items)—Determines if the users can enable and disable sticky columns through the column menu. Defaults to `false`.
* [Set-column-position item](https://www.telerik.com/kendo-angular-ui-develop/components/grid/accessories/column-menu#set-column-position-item)—Displays the **Lock**/**Unlock** and **Stick**/**Unstick** buttons under an expandable **Set Column Position** item instead on a root level. Defaults to `false`.
* [Column Chooser item](https://www.telerik.com/kendo-angular-ui-develop/components/grid/accessories/column-menu#column-chooser-item)—Displays a **Columns** button and an expandable checkbox-style menu with all columns. It enables users to quickly show or hide the Grid columns. Defaults to `true`.

To change the text of the column menu items, see [Customizing Column Menu Messages](https://www.telerik.com/kendo-angular-ui-develop/components/grid/accessories/column-menu#customizing-column-menu-messages).

### Column Menu Layout

To display the column menu items into tabs, set the [`view`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columnmenusettings#view) option of the `ColumnMenuSettings` to `tabbed`:

```html
<kendo-grid ...[columnMenu]="{ view: 'tabbed' }"></kendo-grid>
```

When multiple column menu items are enabled, they are distributed into three tabs:

* **Filter** tab—Includes the Filter item only.
* **General** tab—Includes the sort, lock, stick and resize items.
* **Columns** tab—Includes the Column chooser item only.

The following example demonstrates the tabbed layout of the column menu when all items are enabled.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/grid/column-menu/layout/source.txt)

### Sort Item

The sort item of the column menu is displayed by default if the following conditions are met:

* The [`sortable`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/gridcomponent#sortable) functionality of the Grid is enabled.
* The current column is bound to a field from the Grid model.

To add the sort item without enabling sorting, manually set the [`sort`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columnmenusettings#sort) option of the `ColumnMenuSettings` to `true`. To hide the sort item for individual columns, set the [`sortable`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columncomponent#sortable) option of the column to `false`.

The following example demonstrates the sort item functionality of the column menu.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/grid/column-menu/sort/source.txt)

### Filter Item

The filter item of the column menu is displayed by default if the following conditions are met:

* The [`filterable`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/gridcomponent#filterable) functionality of the Grid is enabled.
* The current column is bound to a field from the Grid model.

To add the filter item without enabling filtering, set the [`filter`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columnmenusettings#filter) option of the `ColumnMenuSettings` to `true`. To hide the filter item for individual columns, set the [`filterable`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columncomponent#filterable) option of the column to `false`.

The following example demonstrates the filter item functionality of the column menu.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/grid/column-menu/filter/source.txt)

### Lock and Unlock Items

The lock and unlock items of the column menu are not displayed by default. To add them, set the [`lock`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columnmenusettings#lock) option of the `ColumnMenuSettings` to `true`. To hide the lock and unlock items for individual columns, set the [`lockable`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columncomponent#lockable) option of the corresponding column to `false`.

> The prerequisites and limitations of the [locked columns](https://www.telerik.com/kendo-angular-ui-develop/components/grid/columns/locked) apply to the lock item too.

The following example demonstrates how to lock and unlock columns from the column menu.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/grid/column-menu/lock/source.txt)

### Stick and Unstick Items

The stick and unstick items of the column menu are not displayed by default. To add them, set the [`stick`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columnmenusettings#stick) option of the `ColumnMenuSettings` to `true`. To hide the stick and unstick items for individual columns, set the [`stickable`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columncomponent#stickable) option of the corresponding column to `false`.

> The prerequisites and limitations of the [sticky columns](https://www.telerik.com/kendo-angular-ui-develop/components/grid/columns/sticky) apply to the stick item too.

The following example demonstrates how to allow users to set the sticky state of Grid columns through the column menu.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/grid/column-menu/stick/source.txt)

### Set-Column-Position Item

By default, the lock and stick items are displayed on the root level of the column menu. To nest them in an expandable **Set Column Position** sub-menu, set the [`setColumnPosition`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columnmenusettings#setColumnPosition) of the `ColumnMenuSettings`to `true`.

> The prerequisites and limitations of the [sticky](https://www.telerik.com/kendo-angular-ui-develop/components/grid/columns/sticky) and [locked](https://www.telerik.com/kendo-angular-ui-develop/components/grid/columns/locked) columns apply to the set-column-position item too.

The following example demonstrates how to add the set-column-position item to the column menu.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/grid/column-menu/set-column-position/source.txt)

### Column Chooser Item

The column chooser item allows you to dynamically show and hide columns through a dedicated sub-menu with checkboxes. The column menu displays a column chooser item by default. To hide it, set the [`columnChooser`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columnmenusettings#columnChooser) option of the `ColumnMenuSettings` to `false`.

The following example demonstrates the column chooser item.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/grid/column-menu/chooser/source.txt)

To exclude a column from the column chooser checkbox list, set the [`includeInChooser`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columncomponent#includeinchooser) property of the respective column to `false`.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/grid/column-menu/chooser-exclude/source.txt)

### AutoSize-Column Item

The autosize-column item allows you to resize the column to the minimum possible width so that it fits the widest header or cell content without wrapping. The option is hidden by default. To display it you must set the following options:

1. [`resizable`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/gridcomponent#resizable) property of the Grid to `true`.
2. [`autoSizeColumn`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columnmenusettings#autosizecolumn) option of the `ColumnMenuSettings` to `true`.

> Using autosize-column item option alongside the [virtual columns](https://www.telerik.com/kendo-angular-ui-develop/components/grid/columns/virtual) functionality is not supported.

The following example demonstrates how to add the autosize-column item to the column menu.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/grid/column-menu/autosize-column/source.txt)

### AutoSize-All-Columns Item

The autosize-all-columns item allows you to resize all columns to the minimum possible width so that they fit the widest header or cell content without wrapping. The option is hidden by default. To display it you must set the following options:

1. [`resizable`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/gridcomponent#resizable) property of the Grid to `true`.
2. [`autoSizeAllColumns`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columnmenusettings#autosizecolumn) option of the `ColumnMenuSettings` to `true`.

> Using autosize-all-columns item option alongside the [virtual columns](https://www.telerik.com/kendo-angular-ui-develop/components/grid/columns/virtual) functionality is not supported.

The following example demonstrates how to add the autosize-all-columns item to the column menu.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/grid/column-menu/autosize-all-columns/source.txt)

### Expandable Menu Items

By default, the column chooser, filter, and set-column-position column menu items are initially collapsed. To change this behavior and make them initially expanded, set the [`expanded`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/expandablecolumnmenuitem) property of the `ExpandableColumnMenuItem` object to `true`.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/grid/column-menu/expandable-menu/source.txt)

## Customizing Column Menu Messages

To change the text of the built-in column menu items without replacing the menu template, use the Grid [`CustomMessagesComponent`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/custommessagescomponent). Place `<kendo-grid-messages>` directly inside `<kendo-grid>` and set the inputs for the labels you want to change. The messages apply to the Grid instance that declares them.

The following snippet customizes the sort, filter, lock, stick, and tab labels of the column menu.

```html
<kendo-grid [data]="gridData" [sortable]="true" [filterable]="true" [columnMenu]="true">
    <kendo-grid-messages
        sortAscending="Sort A to Z"
        sortDescending="Sort Z to A"
        filterFilterButton="Apply filter"
        lock="Lock column"
        unlock="Unlock column"
        stick="Stick column"
        unstick="Unstick column"
        columnMenuGeneralTabTitle="Sort and columns"
        columnMenuFilterTabTitle="Filter"
        columnMenuColumnsTabTitle="Choose columns">
    </kendo-grid-messages>
    <kendo-grid-column field="ProductName" title="Product Name"></kendo-grid-column>
</kendo-grid>
```

For the full list of message inputs, refer to the [`CustomMessagesComponent` API](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/custommessagescomponent). To translate the Grid messages, refer to [Globalization](https://www.telerik.com/kendo-angular-ui-develop/components/grid/globalization#custom-messages).

## Customizing the Content

You can customize the content of the column menu through templates. This approach allows you to specify a column menu template for:

* All Columns—Nest an `<ng-template>` tag with the [`kendoGridColumnMenuTemplate`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columnmenutemplatedirective) directive inside the `kendo-grid` component.
* Specific Column—Nest the template inside the column component tag, for example, inside `kendo-grid-column`.

> Before using the predefined column menu items inside the template, set the [`ColumnMenuService`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columnmenuservice) that is passed by the template to the `service` input of the column menu item.

To include the predefined column menu items in the template, add the following components:

* [`kendo-grid-columnmenu-sort`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columnmenusortcomponent)
* [`kendo-grid-columnmenu-filter`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columnmenufiltercomponent)
* [`kendo-grid-columnmenu-lock`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columnmenulockcomponent)
* [`kendo-grid-columnmenu-stick`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columnmenustickcomponent)
* [`kendo-grid-columnmenu-position`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columnmenupositioncomponent)
* [`kendo-grid-columnmenu-chooser`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columnmenuchoosercomponent)
* [`kendo-grid-columnmenu-autosize-column`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columnmenuautosizecolumncomponent)
* [`kendo-grid-columnmenu-autosize-all-columns`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columnmenuautosizeallcolumnscomponent)

To implement an entirely custom column menu item and include it in the template, use the [`kendo-grid-columnmenu-item`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columnmenuitemcomponent) component.

To enable the built-in keyboard navigation for column menu items used inside the template, set the [`kendoGridColumnMenuItem`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columnmenuitemdirective) directive to the reference of the component:

```html
<ng-template kendoGridColumnMenuTemplate let-service="service" let-column="column">
    <kendo-grid-columnmenu-sort #sortItem [kendoGridColumnMenuItem]="sortItem" [service]="service">
    </kendo-grid-columnmenu-sort>
</ng-template>
```

The following example demonstrates how to define a custom column menu template.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/grid/column-menu/template/source.txt)

## Customizing the Position

By default, the Column Menu is rendered as the last item in the header cell. To change the position of the menu icon in the header:

1. Disable the built-in column menu by setting [`columnMenu`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columncomponent#columnmenu) on the respective column to `false`.
2. Nest an `<ng-template>` tag inside the column and apply a [`kendoGridHeaderTemplate`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/headertemplatedirective) directive to it.
3. Place a [`ColumnMenu`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columnmenucomponent) component anywhere in the header template by nesting a `<kendo-grid-column-menu>` tag inside.
4. Bind the `column` property of the [`ColumnMenu`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columnmenucomponent) component to the `column` field that is passed by the template.
5. Optionally, bind the `sort` and `filter` properties of the [`ColumnMenu`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columnmenucomponent) component to the respective Grid state.

> When used as a standalone component, the [`ColumnMenu`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columnmenucomponent) ignores the [`sortable`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/gridcomponent#sortable) and [`filterable`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/gridcomponent#filterable) settings of the Grid. You must configure the respective column menu items through the component properties instead.

The following example demonstrates the described approach for changing the column menu position inside the cell header template.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/grid/column-menu/standalone/source.txt)

## Hiding the Column Menu per Column

By default, the column menu appears for all columns. To disable the column menu for specific columns, use the [`columnMenu`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columncomponent#columnmenu) option of the respective column and set it to `false`.

The following example demonstrates how to disable the column menu for specific columns.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/grid/column-menu/disable/source.txt)

## Suggested Links

* [API Reference of the `ColumnComponent`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/columncomponent)
* [API Reference of the `GridComponent`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/gridcomponent)
* [API Index of the Grid](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api)
