Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
  [Expand]Reporting
  [Expand]Chart Control
  [Expand]Grid View
  [Expand]Card View
  [Expand]Vertical Grid
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Image and Data Browsing
  [Expand]Docking and Popups
  [Expand]Site Navigation and Layout
  [Expand]File Management
  [Expand]Multi-Use Site Controls
  [Expand]Scheduler
  [Expand]HTML Editor
  [Collapse]Pivot Grid
   [Expand]Getting Started
   [Expand]Fundamentals
   [Expand]Binding to Data
   [Expand]Data Shaping
   [Expand]Data Analysis
   [Expand]Data Formatting
   [Collapse]Layout
     Hierarchical Value Arrangement
     Compact Layout for Hierarchical Row Values
     Field Location and Order
     Data Cell Layout
     Field Groups
    [Expand]Customization Form
     Save and Restore Layout
    [Expand]Paging and Scrolling
   [Expand]Appearance
   [Expand]Data Export
   [Expand]Design-Time Features
   [Expand]UI Elements
   [Expand]Examples
   [Expand]End-User Capabilities
   [Expand]Member Tables
  [Expand]Tree List
  [Expand]Gauges
  [Expand]Data Editors
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [Expand]Localization
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Field Groups

ASPxPivotGrid control provides the capability to arrange its fields into groups. These fields cannot be separated by end-users by dragging one of them to a different area or hiding it on the Customization Form.

Expanded Create Groups at Design Time

The Fields and Groups page of the ASPxPivotGrid Designer provides design-time capabilities to create groups.

You can create a new group at design time in different ways.

  • Select fields you want to combine into a group. Hold down the SHIFT or CTRL key while clicking field names to select multiple fields. Then click the Move to a new group button. This creates a new group and moves the selected fields into it.

  • Right-click the selected fields and choose the Move to a new group item in the invoked context menu.

  • As a result, a new group is created and a group index is assigned to the selected fields.

Expanded Remove Groups

To remove the selected fields from the group and move them to the parent area, click the Move Out button.

You can also move the selected fields from the group using the context menu.

Expanded Create Groups in Code

The ASPxPivotGrid.Groups collection property provides the capability to manage field groups. To create a new group and populate it with fields, follow the steps below.

The first field in the group determines the area where this group is located and a position of a group within the current area. To move the group to a different area or to a new position within the current area, use the PivotGridFieldBase.Area and PivotGridFieldBase.AreaIndex properties of the first field in the group. Setting these properties for the second and/or subsequent fields in the group has no effect. Use the PivotGridFieldBase.GroupIndex property to determine the index of the field group which owns the current field. The fields' inner group index, which determines the place of the field in a field group, will be assigned automatically. To manually change field order in the group, use the PivotGridFieldBase.InnerGroupIndex property.

Grouped fields can be collapsed and expanded by clicking the expand buttons. Collapsing/expanding a grouped field header collapses/expands columns or rows that correspond to grouped child fields. To control the expansion status of the current field in a group, use its PivotGridFieldBase.ExpandedInFieldsGroup property. Use the control PivotGridOptionsCustomization.AllowExpand property to prevent end-users from expanding or collapsing any columns/rows. To prevent end-users from expanding or collapsing columns/rows that correspond to a specific column or row field, use the field PivotGridFieldOptions.AllowExpand property.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E1876.

The following example demonstrates how to combine fields into a group at design time. Follow the steps below to create a new group using the ASPxPivotGrid Designer.

  • Invoke the ASPxPivotGrid Designer.
  • In the Fields and Groups page expand the ColumnArea and select the Year, Quarter and Month fields. Hold down the SHIFT or CTRL key while clicking field names to select multiple fields.

  • Then click the Move to a new group button, that creates a new Year-Quarter-Month group and moves the selected fields into it.

The image below show the result.

The following code demonstrates how to combine fields into a group at runtime.

In this example, three fields (Year, Quarter and Month, respectively) are combined into a new group. This ensures that the Year field will be followed by Quarter which in its turn is followed by Month. If the Year field is being dragged to another area other fields will be dragged as well.

How would you rate this topic?​​​​​​​