You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: blazor/datagrid/frozen-column.md
+45-27Lines changed: 45 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,13 +9,35 @@ documentation: ug
9
9
10
10
# Column Pinning (Frozen) in Blazor DataGrid
11
11
12
-
In the Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid, you have the capability to **freeze** columns, ensuring they remain visible as you scroll through extensive datasets. This functionality significantly improves user experience by keeping critical information constantly within view, even when navigating through large volumes of data. This means that important columns remain fixed in their positions, making it easier to access and reference key data points while working with the Grid.
12
+
The Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid supports freezing columns to keep them visible while scrolling through large datasets. This feature ensures that important fields remain accessible regardless of horizontal scroll position.
13
13
14
-
To know about frozen columns in Grid, you can check this video.
14
+
Column pinning can be configured using either grid-level or column-level settings.
15
+
16
+
**Grid-level freezing**
17
+
18
+
To freeze columns from the left side of the grid:
19
+
20
+
- Set the [FrozenColumns](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_FrozenColumns) property in the [SfGrid](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html) component to a **numeric** value.
21
+
- This value determines how many columns from the **left** remain **fixed** during horizontal scrolling.
22
+
23
+
**Column-level freezing**
24
+
25
+
To freeze specific columns regardless of their position:
26
+
27
+
- Set the [IsFrozen](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_IsFrozen) property of a [GridColumn](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html) to **true**.
28
+
- Use the [Freeze](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_Freeze) property to define the freeze direction. The [FreezeDirection](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.FreezeDirection.html) enum supports the following values:
29
+
30
+
*[Left](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.FreezeDirection.html#Syncfusion_Blazor_Grids_FreezeDirection_Left) – Freezes the column to the left side of the grid.
31
+
*[Right](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.FreezeDirection.html#Syncfusion_Blazor_Grids_FreezeDirection_Right) – Freezes the column to the right side of the grid.
32
+
*[Fixed](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.FreezeDirection.html#Syncfusion_Blazor_Grids_FreezeDirection_Fixed) – Keeps the column fixed in place regardless of scroll direction.
33
+
34
+
These options allow precise control over which columns remain visible during horizontal scrolling.
In the following example, the [FrozenColumns](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_FrozenColumns) property is set to **2**. This configuration freezes the left two columns of the Grid, and they will remain fixed in their positions while the rest of the columns Grid can be scrolled horizontally:
40
+
In this configuration, the `FrozenColumns` property is set to **2**, which keeps the first two columns fixed while the remaining columns can be scrolled horizontally.
> * Frozen columns should not be set outside the Grid view port.
134
-
> *Frozen Grid support column virtualization feature, which helps to improve the Grid performance while loading a large dataset.
135
-
> *The frozen feature is supported only for the columns that are visible in the current view.
136
-
> *You can use both `FrozenColumns` property and [FrozenRows](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_FrozenRows)property in the same application.
155
+
> * Frozen columns must remain within the visible viewport of the grid.
156
+
> *Column virtualization is supported with frozen columns to improve performance when handling large datasets.
157
+
> *Freezing is applicable only to columns currently visible in the grid.
158
+
> *Both [FrozenColumns](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_FrozenColumns)and [FrozenRows](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_FrozenRows)properties can be used together in the same grid.
137
159
138
160
## Change default frozen line color
139
161
140
-
You can customize the frozen line borders of frozen columns in the Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid by applying custom CSS styles to the specific frozen column. This allows you to change the border color of the left frozen columns, right frozen columns, and fixed frozen columns to match your application's design and theme.
162
+
The Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid allows customizing the border color of frozen columns using CSS. This includes styling for **left**, **right**, and **fixed** frozen columns to match application design requirements.
141
163
142
-
To change default frozen line color, use the following class name and apply the border color based on your requirement.
164
+
To change the default frozen line color, apply styles using these class selectors:
143
165
144
-
For left frozen columns:
166
+
***Left frozen columns**
145
167
146
168
```css
147
169
.e-grid.e-leftfreeze.e-freezeleftborder {
148
170
border-right-color: rgb(198, 30, 204);
149
171
}
150
172
```
151
-
For right frozen columns:
173
+
***Right frozen columns**
152
174
153
175
```css
154
176
.e-grid.e-rightfreeze.e-freezerightborder {
155
177
border-left-color: rgb(19, 228, 243);
156
178
}
157
179
```
158
-
For fixed frozen columns, you need to specify both left and right border as mentioned below
180
+
***Fixed frozen columns**
159
181
160
182
```css
161
183
.e-grid.e-fixedfreeze.e-freezeleftborder{
@@ -166,7 +188,6 @@ For fixed frozen columns, you need to specify both left and right border as ment
166
188
border-right-color: rgb(10, 224, 10);
167
189
}
168
190
```
169
-
The following example demonstrates how to change the default frozen line color using CSS:
170
191
171
192
{% tabs %}
172
193
{% highlight razor tabtitle="Index.razor" %}
@@ -274,9 +295,7 @@ The following example demonstrates how to change the default frozen line color u
274
295
275
296
## Detail template with frozen columns
276
297
277
-
The Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid allows columns to be **frozen** while using a [detail template](https://blazor.syncfusion.com/documentation/datagrid/detail-template). The detail template in the Grid enables you to display additional information about a specific row by expanding or collapsing its detail content.
278
-
279
-
Here’s an example of using the **detail template** alongside **frozen columns** in the Grid:
298
+
The Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid supports frozen columns in combination with a [DetailTemplate](https://blazor.syncfusion.com/documentation/datagrid/detail-template). The detail template displays additional information for a row when expanded, without affecting the frozen column layout.
280
299
281
300
{% tabs %}
282
301
{% highlight razor tabtitle="Index.razor" %}
@@ -405,15 +424,12 @@ public class EmployeeDetails
> You can freeze the Grid columns either by using the [IsFrozen](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_IsFrozen) or [FrozenColumns](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_FrozenColumns) properties.
427
+
> * Freeze columns using either the [IsFrozen](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_IsFrozen) or [FrozenColumns](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_FrozenColumns) properties.
409
428
410
429
## Add or remove frozen columns by dragging the column separator
411
430
412
-
The Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid allows you to dynamically add or remove columns from the frozen content by dragging and dropping the column separator. This provides flexibility to customize the Grid layout directly through individual interactions.
413
-
414
-
To enable this feature, set the [AllowFreezeLineMoving](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_AllowFreezeLineMoving) property to **true** in the Grid.
415
-
416
-
Here is an example that demonstrates how to enable and use the `AllowFreezeLineMoving` property in the Grid.
431
+
The Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid allows dynamically modifying frozen columns by dragging and dropping the column separator. This interaction enables adjusting which columns remain frozen, providing flexibility to customize the layout directly through the Grid UI.
432
+
To enable this behavior, set the [AllowFreezeLineMoving](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_AllowFreezeLineMoving) property to **true** in the Grid.
> If frozen columns are not specified, the frozen column separator will be displayed at the left and right ends. You can dynamically change the frozen columns by dragging the column separator.
520
+
> If no columns are frozen, the frozen column separator appears at the **left** and **right** edges of the Grid. Columns can be dynamically frozen or unfrozen by dragging the separator.
505
521
506
522
## Limitations of frozen columns and freeze direction
507
523
508
524
The frozen columns and freeze direction features in Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid have the following limitations:
509
525
510
526
**General limitations for frozen columns**
511
527
528
+
The following features are not compatible with frozen columns:
529
+
512
530
* Row Template
513
531
* Hierarchy DataGrid
514
532
515
533
**Additional limitations for freeze direction**
516
534
517
-
* Infinite scroll in cache mode is not supported.
518
-
* Freeze direction in the stacked header is incompatible with column reordering.
519
-
* Using a cell template or text wrap in any one of the panels may cause variable row heights between the panels. The height is recalculated based on the DOM offset height and applied uniformly across all rows to maintain consistency. This can lead to visual glitches. You can resolve this problem by setting static values for the [RowHeight](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_RowHeight) property in `SfGrid`.
535
+
* Infinite scroll in cache mode is not supported.
536
+
* Freeze direction in the stacked header is incompatible with column reordering.
537
+
* Using a cell template or text wrap in any one of the panels may cause variable row heights between the panels. The height is recalculated based on the DOM offset height and applied uniformly across all rows to maintain consistency. This can lead to visual glitches. To resolve this, set a static value for the [RowHeight](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_RowHeight) property in [SfGrid](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html).
520
538
* The [Freeze](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_Freeze) and [FrozenColumns](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_FrozenColumns) properties are incompatible and cannot be used simultaneously.
521
539
522
-
> You can refer to our [Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid](https://www.syncfusion.com/blazor-components/blazor-datagrid) feature tour page for its groundbreaking feature representations. You can also explore our [Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid example](https://blazor.syncfusion.com/demos/datagrid/overview?theme=bootstrap5) to understand how to present and manipulate data.
540
+
> N> Refer to the [Blazor DataGrid](https://www.syncfusion.com/blazor-components/blazor-datagrid) feature tour for a broad overview. Explore the [Blazor DataGrid example](https://blazor.syncfusion.com/demos/datagrid/overview?theme=bootstrap5) to understand data presentation and manipulation.
0 commit comments