Skip to main content

GridDataColumnGroupRowTemplateContext.ColumnCaption Property

Returns the caption of the grouped column.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

public string ColumnCaption { get; }

Property Value

Type Description
String

The column caption.

Remarks

Use the ColumnCaption property to access the caption of the grouped column. The caption is defined by the column’s Caption property value. If this value is not specified, the Grid defines the column caption based on the FieldName property value.

<DxGrid @ref="Grid"
        Data="@Data"
        ShowGroupPanel="true"
        SizeMode="Params.SizeMode"
        ColumnResizeMode="GridColumnResizeMode.NextColumn"
        TextWrapEnabled="false"
        VirtualScrollingEnabled="true">
    <Columns>
        <DxGridDataColumn FieldName="CompanyName" MinWidth="100" />
        <DxGridDataColumn FieldName="Country" GroupIndex="0" Width="10%">
            <GroupRowTemplate>
                <text>@context.ColumnCaption: @context.GroupValue</text>
                @{
                    var summaryItems = context.Grid.GetGroupSummaryItems();
                    if(summaryItems.Any()) {
                        <text> (</text>
                        foreach(var i in summaryItems) {
                            if(i != summaryItems.First()) {
                                <text>, </text>
                            }
                            @context.Grid.GetGroupSummaryLabel(i, context.VisibleIndex)
                            <text>: </text>
                            <b>@context.Grid.GetGroupSummaryFormattedValue(i, context.VisibleIndex)</b>
                        }
                        <text>)</text>
                    }
                }
            </GroupRowTemplate>
        </DxGridDataColumn>
        <DxGridDataColumn FieldName="City" Width="10%" />
        <DxGridDataColumn FieldName="UnitPrice" DisplayFormat="c" Width="10%" />
        <DxGridDataColumn FieldName="Quantity" Width="10%" />
        <DxGridDataColumn FieldName="Total"
                          UnboundType="GridUnboundColumnType.Decimal"
                          UnboundExpression="[UnitPrice] * [Quantity]"
                          DisplayFormat="c"
                          MinWidth="100"
                          Width="15%" />
    </Columns>
    @* ... *@
</DxGrid>

Blazor Grid Group Row Template

Run Demo: Grid - Group Row Template

See Also