Pivot Grid Fields
- 3 minutes to read
Create and Position Pivot Grid Fields
To visualize data in the Pivot Grid, create Pivot Grid fields and position them in the header areas.
A field can be positioned within one of four areas: Column, Row, Data, and Filter Header Area. The field’s function depends on the area in which it is located:
- Column Header Area
- Lists field values along the control’s top edge. Field values are column headers.
- Row Header Area
- Lists field values along the control’s left edge. Field values are row headers.
- Data Header Area
- Calculates summaries against the fields in column and row areas. The summaries are calculated for all cells, and each cell is identified by a column and a row.
- Filter Header Area
- Displays headers of filter fields. Filter fields allow users to filter the entire Pivot Grid to display data for the predefined values from the filter dropdown list.
Refer to the following article for more information: Field Layout.
Follow the steps below to create and position fields in code:
- Create a PivotGridField object and add it to the PivotGridControl.Fields collection.
- Specify the field’s area and position within this area. For this, use the PivotGridFieldBase.Area and PivotGridFieldBase.AreaIndex properties.
AreaIndexcan be set only after the field is added to the control’s field collection.
Bind Pivot Grid Fields to Data
Pivot Grid uses the Binding API to bind Pivot Grid fields to data. Data binding sources can be columns in a data source, calculated expressions, or window calculations.
Refer to the following help topics for more information on how to bind Pivot Grid fields to different data binding sources:
- Bind Pivot Grid Fields to Data Columns
- Bind Pivot Grid Fields to Calculated Expressions
- Bind Pivot Grid Fields to Window Calculations
To obtain distinct field values which can be used to filter a Pivot Grid’s data, call the PivotGridFieldBase.GetUniqueValues method. See the Filtering Overview topic for more information on Pivot Grid’s data filtering.
Obtain Field Data
Use the following methods to obtain a field’s data:
- Returns an array of the unique values which are stored in the underlying data source in the current field.
- Returns a list of field values that are not excluded by filters applied to other fields and can be displayed.
- Returns the field values currently shown in the PivotGrid.
You can apply filter criteria to Pivot Grid fields to display specific records.
Refer to the Filtering section for more information.