Skip to main content

PivotGridDataSourceBuilder<T>.Fields(Action<CollectionFactory<PivotGridDataSourceFieldBuilder<T>>>) Method

Provides access to the client-side fields option that represents a data source field collection.

Namespace: DevExtreme.AspNet.Mvc.Builders

Assembly: DevExtreme.AspNet.Core.dll

Declaration

public PivotGridDataSourceBuilder<T> Fields(
    Action<CollectionFactory<PivotGridDataSourceFieldBuilder<T>>> configurator
)

Parameters

Name Type Description
configurator Action<CollectionFactory<PivotGridDataSourceFieldBuilder<T>>>

A function that allows you to add items to the collection.

Returns

Type Description
PivotGridDataSourceBuilder<T>

A reference to this instance after the method is called.

Remarks

To configure a data source field collection, use a multiline lambda expression. In this case, a lambda parameter performs the role of a collection factory, and its Add() method adds a new item to the collection. The Add() method returns PivotGridDataSourceFieldBuilder<T> whose methods you can use to configure an item.

@(Html.DevExtreme().PivotGrid()
    .DataSource(ds => ds
        .Fields(fields => {
            fields.Add(); // call methods to configure a data source field
            fields.Add();
        })
    )
)

Refer to Nested Options and Collections for more information.

See Also