[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Collapse]Pivot Grid
   [Expand]Getting Started
   [Expand]Fundamentals
   [Expand]Binding to Data
   [Collapse]Data Shaping
    [Collapse]Summarization
     [Collapse]Summaries
       Summaries Overview
       Automatic Summaries
       Custom Summaries
      [Expand]Summary Display Modes
       Accessing Cell Values
       Drill Down to the Underlying Data
      Totals
      Aggregation Levels
     Grouping
    [Expand]Sorting
    [Expand]Filtering
    [Expand]Editing
     Data Formatting
   [Expand]Data Analysis
   [Expand]Layout
   [Expand]Focus and Navigation
   [Expand]Printing and Exporting
   [Expand]Appearance
   [Expand]Design-Time Features
   [Expand]Miscellaneous
   [Expand]UI Elements
   [Expand]End-User Capabilities
   [Expand]Examples
   [Expand]Member Tables
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Drill Down to the Underlying Data

A pivot grid Cell value is a summary calculated against a Data Field for a subset of records retrieved from the PivotGrid's underlying data source.

Consider the pivot grid shown in the picture below.

The highlighted cell value $8,467.72 is calculated as a sum of Extended Price field values for the records that meet the following criteria:

  • the Country and City field values are equal to the Row Field values (Austria and Graz, respectively)
  • the Order Year and Order Month field values are equal to the Column Field values (2017 and 1, respectively)

The cell's underlying data is shown in the following picture:

To get underlying records for a particular cell, use the CreateDrillDownDataSource method. The following table shows how to access this method in different situations.

Situation Instruction
Click or double-click the cell Handle the PivotGridControl.CellClick or PivotGridControl.CellDoubleClick event and call the PivotCellEventArgsBase<TField, TData, TCustomTotal>.CreateDrillDownDataSource method.
Hit test Call the PivotGridControl.CalcHitInfo method to get a HitInfo object for a test point. If the point belongs to a cell, use the PivotGridHitInfo.CellInfo property to get the PivotCellEventArgs (see PivotCellEventArgs) object. Call its CreateDrillDownDataSource (see PivotCellEventArgsBase<TField, TData, TCustomTotal>.CreateDrillDownDataSource) method.
Get data for a particular cell Call the PivotGridControl.CreateDrillDownDataSource method.
Get data for a particular cell asynchronously Call the PivotGridControl.CreateDrillDownDataSourceAsync method.
Get data for a particular cell Use the GetCellInfo (see PivotGridCells.GetCellInfo) and GetFocusedCellInfo (see PivotGridCells.GetFocusedCellInfo) methods of the PivotGridCells (see PivotGridCells) object accessible with the PivotGridControl.Cells property. Those methods return the PivotCellEventArgs (see PivotCellEventArgs) object. Call its CreateDrillDownDataSource (see PivotCellEventArgsBase<TField, TData, TCustomTotal>.CreateDrillDownDataSource) method.
Calculate custom summary Handle the PivotGridControl.CustomSummary event and call the PivotGridCustomSummaryEventArgsBase<T>.CreateDrillDownDataSource method.
Perform custom draw Handle the PivotGridControl.CustomDrawCell event and call the PivotCustomDrawCellBaseEventArgs.CreateDrillDownDataSource method.
Display custom text Handle the PivotGridControl.CustomCellDisplayText and call the PivotCellEventArgsBase<TField, TData, TCustomTotal>.CreateDrillDownDataSource method.
Display custom images Handle the PivotGridControl.FieldValueImageIndex event and call the PivotFieldImageIndexEventArgs.CreateDrillDownDataSource method.
Customize cells in printout or exported document Handle the PivotGridControl.CustomExportCell event and call the CustomExportCellEventArgsBase.CreateDrillDownDataSource method.

Expanded Example: How to Display the Underlying Records

This example demonstrates how to obtain the records from the control's underlying data source for a particular cell. Double-click a cell to invoke a form that contains a grid to show the underlying data.

Note

The complete sample project How to: Display Underlying (Drill-Down) Records is available in the DevExpress Examples repository.

The primary data source is the Northwind database contained in the SQL Server data file NW.mdf. The application can use the BindingSource component (see System.Windows.Forms.BindingSource) or the LinqServerModeDataSource (see LinqServerModeDataSource) instance to retrieve the data from the database. A LinqServerModeDataSource data source is a queryable data source, and it forces the PivotGrid to operate in server mode. Click the Server Mode toggle switch control (see ToggleSwitch) to switch from one data source to another.

When you double-click the PivotGrid cell, the PivotGridControl.CellDoubleClick event occurs. The following CreateDrillDownDataSource method overrides are called to obtain the list of records associated with the selected cell:

You can also click the Get Grand Total Data button to call the PivotGridControl.CreateDrillDownDataSource method and display all data records that the PivotGridControl uses to show the summarized data.

Expanded See Also

Is this topic helpful?​​​​​​​