DxGrid.GetGroupSummaryValue(IGridSummaryItem, Int32) Method
Gets a group summary item’s value.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.1.dll
NuGet Package: DevExpress.Blazor
#Declaration
public object GetGroupSummaryValue(
IGridSummaryItem item,
int visibleIndex
)
#Parameters
Name | Type | Description |
---|---|---|
item | IGrid |
The group summary item. |
visible |
Int32 | The group row’s index. |
#Returns
Type | Description |
---|---|
Object | The group summary item’s value. |
#Remarks
Note
The Grid bound to an Instant Feedback Data Source or GridGet
method, call the Wait
The following code snippet customizes group rows. These rows contain the group field values and summary values that are formatted in bold.
@using Microsoft.EntityFrameworkCore
@inject IDbContextFactory<NorthwindContext> NorthwindContextFactory
@implements IDisposable
@* ... *@
<DxGrid Data="@Data"
ShowGroupPanel="true">
<Columns>
<DxGridDataColumn FieldName="Country" GroupIndex="0" Width="200px">
<GroupRowTemplate>
<text>@context.DataColumn.FieldName: @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.GetGroupSummaryValue(i, context.VisibleIndex)</b>
}
<text>)</text>
}
}
</GroupRowTemplate>
</DxGridDataColumn>
<DxGridDataColumn FieldName="City" />
<DxGridDataColumn FieldName="OrderDate" Width="200px" />
<DxGridDataColumn FieldName="UnitPrice" DisplayFormat="c" Width="120px" />
<DxGridDataColumn FieldName="Quantity" Width="120px" />
</Columns>
<GroupSummary>
<DxGridSummaryItem SummaryType="GridSummaryItemType.Count" FieldName="Country" />
</GroupSummary>
</DxGrid>
@* ... *@
@code {
object Data { get; set; }
NorthwindContext Northwind { get; set; }
@* ... *@
IGrid Grid2 { get; set; }
protected override void OnInitialized() {
Northwind = NorthwindContextFactory.CreateDbContext();
Data = Northwind.Invoices
.ToList();
}
@* ... *@
public void Dispose() {
Northwind?.Dispose();
}
}
For more information about summaries in the Grid component, refer to the following topic: Summary in Blazor Grid.