Skip to main content

DxGrid.IsGroupRow(Int32) Method

Specifies whether the specified row is a group row.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

public bool IsGroupRow(
    int visibleIndex
)

Parameters

Name Type Description
visibleIndex Int32

The row’s visible index.

Returns

Type Description
Boolean

true if the specified row is a group row; otherwise, false.

Remarks

Note

The Grid bound to an Instant Feedback Data Source or GridDevExtremeDataSource loads data asynchronously in small portions (instead of the entire dataset). Before you call the IsGroupRow method, call the WaitForRemoteSourceRowLoadAsync(Int32) method to ensure that the specified data row is loaded.

The code below checks whether row 2 is a group row and if it is expanded.

@using Microsoft.EntityFrameworkCore
@inject IDbContextFactory<NorthwindContext> NorthwindContextFactory
@implements IDisposable

<DxGrid Data="GridDataSource"
        ShowGroupPanel="true"
        CustomizeCellDisplayText="OnCustomizeCellDisplayText"
        @ref="@MyGrid">
    <Columns>
        <DxGridDataColumn FieldName="OrderDate"
                          DisplayFormat="d"
                          GroupInterval="GridColumnGroupInterval.DateMonth" />
        <DxGridDataColumn FieldName="Customer"
                          SortMode="GridColumnSortMode.DisplayText"
                          GroupInterval="GridColumnGroupInterval.DisplayText" />
        <DxGridDataColumn FieldName="Freight"
                          DisplayFormat="n2" />
    </Columns>
</DxGrid>

<p></p>
<DxButton Click="@(() => MyGrid.GroupBy("OrderDate"))">Group by Order Date</DxButton>

<p></p>
<DxButton Click="@OnIsGroupRow">Check if the Row 2 is a group row</DxButton>

@Alert

@code {
    IGrid MyGrid { get; set; }
    object GridDataSource { get; set; }
    NorthwindContext Northwind { get; set; }
    string Alert;

    protected override void OnInitialized() {
        Northwind = NorthwindContextFactory.CreateDbContext();
        GridDataSource = Northwind.Orders
            .Include(i => i.Customer)
            .Include(i => i.OrderDetails)
            .Include(i => i.ShipViaNavigation)
            .ToList();
    }

    void OnCustomizeCellDisplayText(GridCustomizeCellDisplayTextEventArgs e) {
        if (e.FieldName == "Customer") {
            var customer = (Customer)e.Value;
            e.DisplayText = $"{customer.CompanyName} ({customer.Country}, {customer.City})";
        }
    }

    void OnIsGroupRow() {
        if (MyGrid.IsGroupRow(2)) {
            if (MyGrid.IsGroupRowExpanded(2) == true)
                Alert = "Row 2 is a group row. The row is expanded.";
            else
                Alert = "Row 2 is a group row. The row is collapsed.";
        }
        else {
            Alert = "Row 2 is not a group row";
        }
    }

    public void Dispose() {
        Northwind?.Dispose();
    }
}

Blazor Grid Page Size Selector

Implements

See Also