CollectionFactoryExpressionExtensions.AddFor<TRow, TColumn, TDisplayColumn>(CollectionFactory<DataGridSummaryGroupItemBuilder<TRow>>, Expression<Func<TRow, TColumn>>, Expression<Func<TRow, TDisplayColumn>>) Method
Adds a group summary item to a specific column of a strongly-typed DataGrid.
Namespace: DevExtreme.AspNet.Mvc
Assembly: DevExtreme.AspNet.Core.dll
#Declaration
public static DataGridSummaryGroupItemBuilder<TRow> AddFor<TRow, TColumn, TDisplayColumn>(
this CollectionFactory<DataGridSummaryGroupItemBuilder<TRow>> factory,
Expression<Func<TRow, TColumn>> column,
Expression<Func<TRow, TDisplayColumn>> displayColumn
)
#Parameters
Name | Type | Description |
---|---|---|
factory | Collection |
The Data |
column | Expression<Func<TRow, TColumn>> | A strongly-typed lambda expression. Returns a model property that supplies data to a summary item. |
display |
Expression<Func<TRow, TDisplay |
A strongly-typed lambda expression. Returns a model property that corresponds to the column where a summary item should be displayed. |
#Type Parameters
Name | Description |
---|---|
TRow | The model type of the strongly-typed Data |
TColumn | The type of the expression result. |
TDisplay |
The type of the expression result. |
#Returns
Type | Description |
---|---|
Data |
A reference to this instance after the method is called. |
#Remarks
Use this extension method to add a group summary item to a specific column of a strongly-typed DataGrid.
The method performs the following actions:
- Creates a new summary item
Binds the summary item to two model properties:
- the property that supplies data for the item
- the property that corresponds to the column where the item should be placed
- Returns a DataGridSummaryGroupItemBuilder<T> instance so you can use its methods to customize the summary item
@(Html.DevExtreme().DataGrid<OrderViewModel>()
.Summary(summary => summary
.GroupItems(groupItems => {
groupItems.AddFor(m => m.OrderDate, m => m.OrderId); // call methods in a chain to customize the summary item
})
)
)
Refer to Nested Options and Collections for more information.