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 | CollectionFactory<DataGridSummaryGroupItemBuilder<TRow>> | The DataGrid summary item collection factory. |
column | Expression<Func<TRow, TColumn>> | A strongly-typed lambda expression. Returns a model property that supplies data to a summary item. |
displayColumn | Expression<Func<TRow, TDisplayColumn>> | 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 DataGrid. |
TColumn | The type of the expression result. |
TDisplayColumn | The type of the expression result. |
Returns
Type | Description |
---|---|
DataGridSummaryGroupItemBuilder<TRow> | 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.