DataGridHtmlRowDecorationType Enum

Lists values that identify rows within the DxDataGrid<T> component.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.dll

Declaration

public enum DataGridHtmlRowDecorationType

Members

Name Description
DataRow

Corresponds to a data row.

DetailRow

Corresponds to a detail row.

GroupRow

Corresponds to a group row.

EditFormRow

Corresponds to a row that contains the Edit Form.

Remarks

This enumeration's values are used to set the RowType event argument's value.

The RowType value defines the HtmlRowDecoration event arguments' type:

The corresponding arguments allow you to decorate grid rows of a specific type (for example, all data rows) in the same manner. The code below applies different CSS classes to different grid rows subject to their RowType property values.

<DxDataGrid Data="@forecasts"
            PageSize="5"
            ShowFilterRow="false"
            HtmlRowDecoration="@OnHtmlRowDecoration">
    <DxDataGridCommandColumn Width="150px"></DxDataGridCommandColumn>
    <DxDataGridColumn Field="@nameof(WeatherForecast.TemperatureC)" Caption="@("Temp. (\x2103)")" TextAlignment="@DataGridTextAlign.Right"></DxDataGridColumn>
    <DxDataGridSpinEditColumn Field="@nameof(WeatherForecast.TemperatureF)" Caption="@("Temp. (\x2109)")"></DxDataGridSpinEditColumn>
    <DxDataGridComboBoxColumn Field="@nameof(WeatherForecast.Summary)" Caption="Summary" Data="@summaries"></DxDataGridComboBoxColumn>
    <DxDataGridDateEditColumn Field="@nameof(WeatherForecast.Date)" DisplayFormatString="D" EditFormatString="d"></DxDataGridDateEditColumn>
</DxDataGrid>

@code {
    WeatherForecast[] forecasts;
    string[] summaries;

    protected override async Task OnInitializedAsync()
    {
        forecasts = await ForecastService.GetForecastAsync();
        summaries = await ForecastService.GetSummariesAsync();
    }

    void OnHtmlRowDecoration(DataGridHtmlRowDecorationEventArgs<WeatherForecast> eventArgs)
    {
        switch (eventArgs.RowType) {

            case DataGridHtmlRowDecorationType.DataRow:
                eventArgs.CssClass += " table-light";
                break;
            case DataGridHtmlRowDecorationType.EditFormRow:
                eventArgs.CssClass += " table-primary";
                break;
            default:
                eventArgs.CssClass += " table-reflow";
                break;
        }
    }
}

Blazor-DataGrid-Row-Type

See Also