DxGrid.IsGroupRowExpanded(Int32) Method
Specifies whether the specified group row is expanded.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.1.dll
NuGet Package: DevExpress.Blazor
Declaration
public bool IsGroupRowExpanded(
int visibleIndex
)
Parameters
Name | Type | Description |
---|---|---|
visibleIndex | Int32 | The row’s visible index. |
Returns
Type | Description |
---|---|
Boolean |
|
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 IsGroupRowExpanded
method, call the WaitForRemoteSourceRowLoadAsync(Int32) method to ensure that the specified data row is loaded.
The following code snippet 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();
}
}
For more information about data grouping in the Grid component, refer to the following topic: Group Data in Blazor Grid.