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/column-headers.md
+4-20Lines changed: 4 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,23 +11,9 @@ documentation: ug
11
11
12
12
The Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid provides options to customize and manage headers for better data organization and presentation.
13
13
14
-
**Key properties for header customization:**
15
-
16
-
***HeaderText** – Displays custom text in the column header instead of the default field name.
17
-
***HeaderTemplate** – Renders custom HTML or Blazor components in the header cell.
18
-
***HeaderTextAlign** – Aligns header text horizontally using **Left**, **Center**, **Right**, or **Justify**.
19
-
***Stacked Headers** – Groups multiple columns under a single header for better organization.
20
-
***Auto-Wrap Header Text** – Wraps header text when it exceeds column width using `AllowTextWrap` and `TextWrapSettings.WrapMode`.
21
-
***Header Height** – Customizes header height using CSS.
22
-
***Dynamic Header Text** – Updates header text at runtime using event or methods.
23
-
***Orientation** – Changes header text orientation (vertical, diagonal, or custom angle) using CSS and `CustomAttributes`.
24
-
***Tooltip for Header** – Adds custom tooltips to header cells using `HeaderTemplate` and `SfTooltip`.
25
-
***Customize Header Text Style** – Applies styles such as font, color, and background using CSS, `CustomAttributes`, or `HeaderCellInfo` event.
26
-
27
14
## Header text
28
15
29
-
The Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid displays the header text of a column from its [Field](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_Field) value by default.
30
-
16
+
The Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid displays the header text of a column from its [Field](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_Field) value by default.
31
17
To override this and provide a custom header title, define the [HeaderText](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_HeaderText) property in the [GridColumn](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html).
32
18
33
19
{% tabs %}
@@ -438,9 +424,7 @@ The alignment can be changed by setting `HeaderTextAlign` to one of the followin
438
424
439
425
## Autowrap the header text
440
426
441
-
The Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid supports wrapping header text when it exceeds the column width.
442
-
443
-
Enable this feature by setting the [AllowTextWrap](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_AllowTextWrap) property to **true**. Configure the wrap mode using the [TextWrapSettings.WrapMode](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_TextWrapSettings) property.
427
+
The Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid supports wrapping header text when it exceeds the column width. Enable this feature by setting the [AllowTextWrap](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_AllowTextWrap) property to **true**. Configure the wrap mode using the [TextWrapSettings.WrapMode](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_TextWrapSettings) property.
444
428
445
429
Specify appropriate column widths using the [Width](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_Width) property to ensure proper wrapping.
446
430
@@ -454,8 +438,6 @@ Wrap modes determine whether header text, content, or both are wrapped:
454
438
> * Header text without white space does not wrap.
455
439
> * For cells containing HTML tags, use [HeaderTemplate](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_HeaderTemplate) and [Template](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_Template) properties for customization.
456
440
457
-
The following example demonstrates how to dynamically change the auto-wrap of the header text based on DropDown change:
458
-
459
441
{% tabs %}
460
442
{% highlight razor tabtitle="Index.razor" %}
461
443
@using Syncfusion.Blazor.Grids
@@ -1069,6 +1051,8 @@ public class OrderDetails
1069
1051
{% endhighlight %}
1070
1052
{% endtabs %}
1071
1053
1054
+
> The Syncfusion Blazor DataGrid component includes a built-in feature to customize tooltip content for both header cells and content cells. For more information, refer to the documentation [here](https://blazor.syncfusion.com/documentation/datagrid/cell#show-tooltip).
Column definitions act as the [DataSource](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_DataSource) schema for the Grid. Operations such as sorting, filtering, and grouping are performed based on these definitions. The [Field](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_Field) property is essential for mapping `DataSource` values to Grid columns.
15
15
16
-
**Ways to render columns in Blazor DataGrid**
17
-
18
-
***Manually defined columns:** Columns are explicitly declared using [GridColumn](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html) for complete control over properties such as [Field](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_Field), [HeaderText](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_HeaderText), [Type](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_Type), and [Width](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_Width).
19
-
20
-
***Auto-generated columns:** When no column definitions are provided or AutoGenerateColumns is enabled, the Grid automatically creates columns based on the properties of the bound data model.
21
-
22
-
***Dynamic columns:** Columns can be generated or modified at **runtime** based on requirements or dynamic data sources. This includes scenarios where columns are created using reflection or dynamic objects such as **ExpandoObject** for flexible data structures.
23
-
24
-
***Complex data binding:** Dot notation in the `Field` property allows binding to nested object values for hierarchical or complex data structures.
25
-
26
-
***Foreign key columns:** Related data from a [ForeignDataSource](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridForeignColumn-1.html#Syncfusion_Blazor_Grids_GridForeignColumn_1_ForeignDataSource) can be displayed based on the value of a complex column using [GridForeignColumn](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridForeignColumn-1.html) configuration.
27
-
28
16
> * If the column `Field` is not present in the `DataSource`, the column will display **empty** values.
29
17
> * If the `Field` name contains a **dot** operator, it is treated as complex binding.
30
18
> * The `Field` property must be defined for a [Template](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_Template) column to enable CRUD and data operations such as filtering and searching.
@@ -468,11 +456,11 @@ Columns can be generated dynamically at runtime by binding data as a list of [Ex
468
456
469
457
## Complex data generation
470
458
471
-
The Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid supports complex data binding using the dot (.) operator in the [Field](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_Field) property. This feature is useful for displaying nested or hierarchical data structures.
459
+
The Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid supports complex data binding using the **dot (.)** operator in the [Field](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_Field) property. This feature is useful for displaying nested or hierarchical data structures.
472
460
473
461
### Using local data
474
462
475
-
To bind local data to the Grid using the [DataSource](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_DataSource) property, use the dot (.) operator in the [Field](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_Field) property of the [GridColumn](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html).
463
+
To bind local data to the Grid using the [DataSource](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_DataSource) property, use the **dot (.)** operator in the [Field](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_Field) property of the [GridColumn](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html).
476
464
477
465
This approach is helpful for binding nested properties like **Employee.FirstName** and **Employee.LastName** from a nested **Employee** object.
478
466
@@ -577,7 +565,7 @@ Complex data binding can be enabled by adding the [Expand](https://help.syncfusi
577
565
578
566
[ExpandoObject](https://blazor.syncfusion.com/documentation/datagrid/data-binding/data-binding#expandoobject-binding) is used when properties need to be added dynamically at runtime. This is suitable for scenarios where the data structure is not fixed.
579
567
580
-
Complex data binding can be achieved by using the dot (.) operator in the [Field](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_Field) property when working with ExpandoObject.
568
+
Complex data binding can be achieved by using the **dot (.)** operator in the [Field](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_Field) property when working with ExpandoObject.
581
569
582
570
{% tabs %}
583
571
{% highlight razor tabtitle="Index.razor" %}
@@ -632,7 +620,7 @@ Complex data binding can be achieved by using the dot (.) operator in the [Field
632
620
633
621
[DynamicObject](https://blazor.syncfusion.com/documentation/datagrid/data-binding#dynamicobject-binding) is used when custom logic for property access or dynamic behavior is required.
634
622
635
-
Complex data binding can be achieved by using the dot (.) operator in the [Field](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_Field) property when working with DynamicObject.
623
+
Complex data binding can be achieved by using the **dot (.)** operator in the [Field](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_Field) property when working with DynamicObject.
636
624
637
625
{% tabs %}
638
626
{% highlight razor tabtitle="Index.razor" %}
@@ -694,7 +682,7 @@ Complex data binding can be achieved by using the dot (.) operator in the [Field
694
682
{% endhighlight %}
695
683
{% endtabs %}
696
684
697
-
> * you can perform the Data operations and CRUD operations for Complex DynamicObject binding fields too.
685
+
> * Data operations and CRUD operations can also be performed on complex DynamicObject binding fields.
0 commit comments