Skip to content

Commit fb11f71

Browse files
992126: Updated the UG content and samples for Columns in Blazor DataGrid
1 parent ce075b6 commit fb11f71

File tree

2 files changed

+9
-37
lines changed

2 files changed

+9
-37
lines changed

blazor/datagrid/column-headers.md

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,9 @@ documentation: ug
1111

1212
The Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor DataGrid provides options to customize and manage headers for better data organization and presentation.
1313

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-
2714
## Header text
2815

29-
The Syncfusion<sup style="font-size:70%">&reg;</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<sup style="font-size:70%">&reg;</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.
3117
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).
3218

3319
{% tabs %}
@@ -438,9 +424,7 @@ The alignment can be changed by setting `HeaderTextAlign` to one of the followin
438424
439425
## Autowrap the header text
440426

441-
The Syncfusion<sup style="font-size:70%">&reg;</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<sup style="font-size:70%">&reg;</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.
444428

445429
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.
446430

@@ -454,8 +438,6 @@ Wrap modes determine whether header text, content, or both are wrapped:
454438
> * Header text without white space does not wrap.
455439
> * 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.
456440
457-
The following example demonstrates how to dynamically change the auto-wrap of the header text based on DropDown change:
458-
459441
{% tabs %}
460442
{% highlight razor tabtitle="Index.razor" %}
461443
@using Syncfusion.Blazor.Grids
@@ -1069,6 +1051,8 @@ public class OrderDetails
10691051
{% endhighlight %}
10701052
{% endtabs %}
10711053

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).
1055+
10721056
{% previewsample "https://blazorplayground.syncfusion.com/embed/LtrJirtAJDjvaNlx?appbar=false&editor=false&result=true&errorlist=false&theme=bootstrap5" %}
10731057

10741058
## Customize header text styles

blazor/datagrid/column-rendering.md

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,6 @@ The Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor DataGrid provides fl
1313

1414
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.
1515

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-
2816
> * If the column `Field` is not present in the `DataSource`, the column will display **empty** values.
2917
> * If the `Field` name contains a **dot** operator, it is treated as complex binding.
3018
> * 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
468456

469457
## Complex data generation
470458

471-
The Syncfusion<sup style="font-size:70%">&reg;</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<sup style="font-size:70%">&reg;</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.
472460

473461
### Using local data
474462

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).
476464

477465
This approach is helpful for binding nested properties like **Employee.FirstName** and **Employee.LastName** from a nested **Employee** object.
478466

@@ -577,7 +565,7 @@ Complex data binding can be enabled by adding the [Expand](https://help.syncfusi
577565
578566
[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.
579567
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.
581569
582570
{% tabs %}
583571
{% highlight razor tabtitle="Index.razor" %}
@@ -632,7 +620,7 @@ Complex data binding can be achieved by using the dot (.) operator in the [Field
632620
633621
[DynamicObject](https://blazor.syncfusion.com/documentation/datagrid/data-binding#dynamicobject-binding) is used when custom logic for property access or dynamic behavior is required.
634622
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.
636624
637625
{% tabs %}
638626
{% highlight razor tabtitle="Index.razor" %}
@@ -694,7 +682,7 @@ Complex data binding can be achieved by using the dot (.) operator in the [Field
694682
{% endhighlight %}
695683
{% endtabs %}
696684
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.
698686
699687
{% previewsample "https://blazorplayground.syncfusion.com/embed/BtBgNdrjLuIpsnpS?appbar=false&editor=false&result=true&errorlist=false&theme=bootstrap5" %}
700688

0 commit comments

Comments
 (0)