Column Resizing

The Ignite UI for Web Components Data Grid supports the ability to resize columns, giving you flexibility over how you wish to display your columns with respect to the width of each.

Demo

Column resizing in the Ignite UI for Web Components DataGrid is on by default, and can be controlled by using the columnResizingMode property of the grid. This property has three options. Each option is explained below:

  • Deferred: The default option. When resizing, a separator will appear showing how large or small the column will become when resized.
  • Immediate: When resizing, there will be no separator. The column's width will follow the pointer as you drag the edge of the column and resize accordingly.
  • None: Columns cannot be resized.

When column resizing is set to Deferred, the separator that shows up can be modified in color and width by using the columnResizingSeparatorBackground and columnResizingSeparatorWidth properties of the grid, respectively.

You can also animate the columns as they resize when the resizing mode is set to Deferred only. This is done by setting the columnResizingAnimationMode property to Interpolate.

Each column in the grid can be determined whether or not it can resize individually. If you want to enable or disable resizing on a particular column, you can set the IsResizingEnabled property of that column.

When resizing a star-width column, it will change that column to a fixed column.

Code Snippet

The following code snippet demonstrates how to implement column resizing in the grid, where the Street column in this case will not be resizable. In this case, the column resizing separator will be 5 pixels wide and the columns that are resizable would animate when resized as well:

import { ColumnResizingMode } from 'igniteui-react-grids/ES5/ColumnResizingMode';
import { ColumnResizingAnimationMode } from 'igniteui-react-grids/ES5/ColumnResizingAnimationMode';
<igc-live-grid id="grid"
    auto-generate-columns="false"
    height="500px"
    width="500px"
    column-resizing-mode="Deferred"
    column-resizing-animation-mode="Interpolate"
    column-moving-separator-width="5" >
    <igc-text-column property-path="FirstName"></igc-text-column>
    <igc-text-column property-path="LastName"></igc-text-column>
    <igc-text-column property-path="Street" is-resizing-enabled=false></igc-text-column>
    <igc-text-column property-path="City"></igc-text-column>
</igc-live-grid>
let grid1 = (document.getElementById("grid") as IgcLiveGridComponent);
grid1.dataSource = data;