CollectionFactoryExpressionExtensions.AddFor<TField, TProperty>(CollectionFactory<FilterBuilderFieldBuilder<TField>>, Expression<Func<TField, TProperty>>) Method
Adds fields to a strongly-typed FilterBuilder.
Namespace: DevExtreme.AspNet.Mvc
Assembly: DevExtreme.AspNet.Core.dll
Declaration
public static FilterBuilderFieldBuilder<TField> AddFor<TField, TProperty>(
this CollectionFactory<FilterBuilderFieldBuilder<TField>> factory,
Expression<Func<TField, TProperty>> expression
)
Parameters
Name | Type | Description |
---|---|---|
factory | CollectionFactory<FilterBuilderFieldBuilder<TField>> | The FilterBuilder field collection factory. |
expression | Expression<Func<TField, TProperty>> | A strongly-typed lambda expression. Returns a model property that supplies data to a field. |
Type Parameters
Name | Description |
---|---|
TField | The model type of the strongly-typed FilterBuilder. |
TProperty | The type of the expression result. |
Returns
Type | Description |
---|---|
FilterBuilderFieldBuilder<TField> | A reference to this instance after the method is called. |
Remarks
Use this extension method to add fields to a strongly-typed FilterBuilder.
The method performs the following actions:
- Creates a new field
- Binds the field to the model property specified by the lambda expression
- Returns a FilterBuilderFieldBuilder<T> instance so you can use its methods to customize the field
@(Html.DevExtreme().FilterBuilder<OrderViewModel>()
.Fields(fields => {
fields.AddFor(m => m.OrderDate); // call methods in a chain to customize the field
fields.AddFor(m => m.ShipCity);
})
)
Refer to Nested Options and Collections for more information.
See Also