CollectionFactoryExpressionExtensions.AddFor<TRow, TProperty>(CollectionFactory<DataGridSummaryGroupItemBuilder<TRow>>, Expression<Func<TRow, TProperty>>) Method
Adds group summary items to a strongly-typed DataGrid.
Namespace: DevExtreme.AspNet.Mvc
Assembly: DevExtreme.AspNet.Core.dll
Declaration
public static DataGridSummaryGroupItemBuilder<TRow> AddFor<TRow, TProperty>(
this CollectionFactory<DataGridSummaryGroupItemBuilder<TRow>> factory,
Expression<Func<TRow, TProperty>> expression
)
Parameters
Name | Type | Description |
---|---|---|
factory | CollectionFactory<DataGridSummaryGroupItemBuilder<TRow>> | The DataGrid summary item collection factory. |
expression | Expression<Func<TRow, TProperty>> | A strongly-typed lambda expression. Returns a model property that supplies data to a summary item. |
Type Parameters
Name | Description |
---|---|
TRow | The model type of the strongly-typed DataGrid. |
TProperty | 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 group summary items to a strongly-typed DataGrid.
The method performs the following actions:
- Creates a new summary item
- Binds the summary item to the model property specified by the lambda expression
- 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); // call methods in a chain to customize the summary item
groupItems.AddFor(m => m.ShipCity);
})
)
)
Refer to Nested Options and Collections for more information.
Note
A summary item is placed in the column that provides data for it. To add it to another column, use this method overload.
See Also