DxDataGridColumn.GroupIndex Property

Specifies the column’s index among group columns. If the property is set to -1, the grid data is not grouped by this column.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v21.1.dll

Declaration

[Parameter]
[DefaultValue(-1)]
public int GroupIndex { get; set; }

Property Value

Type Default Description
Int32

-1

The column’s index among group columns. -1 if the data grid is not grouped by this column.

Remarks

Set a column’s GroupIndex property to a zero-based integer value to group grid data by this column in code. If you group data by multiple columns, this property specifies the group level. The lower the value, the higher a column’s group level. In the following example, the grid first groups data by a column with GroupIndex = 0 and then by a column with GroupIndex = 1.

<DxDataGrid Data="@Data" ShowPager="true" ShowGroupPanel="true">
    <DxDataGridColumn Field="@nameof(Customer.ContactName)" />
    <DxDataGridColumn Field="@nameof(Customer.CompanyName)" />
    <DxDataGridColumn Field="@nameof(Customer.City)" GroupIndex="1" Width="200px" />
    <DxDataGridColumn Field="@nameof(Customer.Region)" Width="120px" />
    <DxDataGridColumn Field="@nameof(Customer.Country)" GroupIndex="0" Width="200px" />
</DxDataGrid>

DataGrid Group

If you set the column’s GroupIndex property to a negative integer value (for instance, -1), the grid is not grouped by the corresponding column.

Run Demo: Data Grid - Grouping

See Also