Compare Columns Effortlessly Using Column Pinning Feature in Syncfusion Data Grid
Tags: javascript, react, angular, webdev
Published: 2020-01-28 11:57:26

---
title: Compare Columns Effortlessly Using Column Pinning Feature in Syncfusion Data Grid
published: true
date: 2020-01-27 12:00:46 UTC
tags: javascript, react, angular, webdev
canonical_url: https://www.syncfusion.com/blogs/post/compare-columns-effortlessly-using-column-pinning-data-grid.aspx
cover_image: https://www.syncfusion.com/blogs/wp-content/uploads/2019/11/Blog_1x-1.jpg
---

The column-pinning feature is used to move any column to the left side as fixed or frozen while scrolling horizontally. This feature is mostly used when the grid has more columns than fit in the viewing area and users want specific columns always visible while scrolling.

[Syncfusion Data Grid](https://www.syncfusion.com/javascript-ui-controls/js-data-grid) offers an API in the column model. It can be used to pin a specific column at the initial state or dynamically. Users can not only use the column menu or context menu to pin a column, but also drag a column or pin it dynamically.

The Syncfusion Data Grid follows the Microsoft Excel prototype and offers left-side column pinning only.

## Usability overview

The Data Grid column pinning feature has the following functionalities:

- [Pin a column through the column menu or context menu](#pinning-column-through-column%20menu-context-menu)
- [Pin a column by dragging it](#pinning-column-by-dragging)
- [Pin an initial column dynamically](#pinning-an-initial-column-dynamically)
- [Pin subsequent columns dynamically](#pinning-subsequent-columns-dynamically)

This set of features will be achieved by users with simple configuration (through an API). This kind of flexibility in feature usage is powered by the Syncfusion Data Grid. Now, let’s see each feature usage in more detail.

### Pinning a column through the column menu or context menu

The Syncfusion Data Grid provides users an option to pin a column through UI interaction by using the column menu or context menu, or other grid actions like right-clicking. The following image illustrates how a column is pinned through UI interaction.

![Pinning a column through the column menu or context menu.](https://www.syncfusion.com/blogs/wp-content/uploads/2019/11/Pinning-a-column-through-the-column-menu-or-context-menu.gif)

Sample: [https://stackblitz.com/edit/9tpg7w-5xjonh?file=index.ts](https://stackblitz.com/edit/9tpg7w-5xjonh?file=index.ts)

### Pinning a column by dragging

You can also drag any column to pin it. Data Grid does not restrict the number of columns being pinned. The following image illustrates the pinning functionally by simply dragging the column header to the first position.

![Pinning a column by dragging.](https://www.syncfusion.com/blogs/wp-content/uploads/2019/11/Pinning-a-column-by-dragging.gif)

Sample: [https://stackblitz.com/edit/9tpg7w-lrnuno?file=index.ts](https://stackblitz.com/edit/9tpg7w-lrnuno?file=index.ts)

### Pinning an initial column dynamically

Most data grid components provide only the option to pin a column during initial rendering, but Syncfusion Data Grid lets users pin a column dynamically. The following demo illustrates how to pin a column by simply clicking the toggle icon in the column header. It has been achieved with minimal configuration in the Data Grid.

![Pinning an initial column dynamically.](https://www.syncfusion.com/blogs/wp-content/uploads/2019/11/Pinning-an-initial-column-dynamically.gif)

Sample: [https://stackblitz.com/edit/9tpg7w-cud2zl?file=index.ts](https://stackblitz.com/edit/9tpg7w-cud2zl?file=index.ts)

### Pinning subsequent columns dynamically

Pinning a column is compatible with major grid features such as subsequent columns and aggregation. The following image illustrates this functionality in Syncfusion Data Grid.

## ![Pinning subsequent columns dynamically.](https://www.syncfusion.com/blogs/wp-content/uploads/2019/11/Pinning-subsequent-columns-dynamically.png)Conclusion

In this blog post, we have seen how to pin columns while scrolling horizontally in the Data Grid control. The [Syncfusion Data Grid](https://www.syncfusion.com/javascript-ui-controls/js-data-grid) offers column menu, context menu, and dragging support to pin any column. You can check out the project samples provided under each topic. Feel free to try out this sample and share your feedback in the comments section.

You can find the Essential JS 2 install download link [on our website](https://www.syncfusion.com/downloads/essential-js2).  Please take a look at our live demos in our [sample browser](https://ej2.syncfusion.com/demos/#/material/grid/grid-overview.html), and for more details refer to our [documentation](https://ej2.syncfusion.com/demos/#/material/grid/grid-overview.html).

You can also contact us through our [support forum](https://www.syncfusion.com/forums), [Direct-Trac](https://www.syncfusion.com/account/login), or [feedback portal](https://www.syncfusion.com/feedback/javascript). We are happy to assist you!

The post [Compare Columns Effortlessly Using Column Pinning Feature in Syncfusion Data Grid](https://www.syncfusion.com/blogs/post/compare-columns-effortlessly-using-column-pinning-data-grid.aspx) appeared first on [Syncfusion Blogs](https://www.syncfusion.com/blogs).