Back to Devexpress

PivotCellEventArgs.CreateDrillDownDataSourceAsync() Method

windowsforms-devexpress-dot-xtrapivotgrid-dot-pivotcelleventargs-b2d55ce4.md

latest4.8 KB
Original Source

PivotCellEventArgs.CreateDrillDownDataSourceAsync() Method

Returns a list of records used to calculate a summary value for the specified cell asynchronously.

Namespace : DevExpress.XtraPivotGrid

Assembly : DevExpress.XtraPivotGrid.v25.2.dll

NuGet Package : DevExpress.Win.PivotGrid

Declaration

csharp
public Task<PivotDrillDownDataSource> CreateDrillDownDataSourceAsync()
vb
Public Function CreateDrillDownDataSourceAsync As Task(Of PivotDrillDownDataSource)

Returns

TypeDescription
Task<PivotDrillDownDataSource>

An asynchronous operation that returns PivotDrillDownDataSource.

|

Remarks

Cells in the Pivot Grid display summary and total summary values. Each summary and total summary value is calculated for a specific subset of records in the control’s underlying data source. These records are identified by the values of the column and row fields displayed within the column and row headers.

The CreateDrillDownDataSourceAsync method allows you to retrieve the subset of records from the control’s underlying data source, used to calculate the summary value for the current cell.

In Server and OLAP modes, the CreateDrillDownDataSourceAsync method returns only visible fields. To get hidden field values, use the method’s overloads with the customColumns parameter that allows you to specify the columns to return.

Example

Run Demo: OLAP Drill Down

The code snippet below shows how to create a drill-down data source for the selected Pivot Grid cell and how to display the resulting data source in the DrillDownForm dialog.

csharp
using DevExpress.XtraEditors;
using DevExpress.XtraPivotGrid;
using System;
using System.Windows.Forms;

namespace DxSampleOLAP {
    public partial class OLAPDrillDownUserControl : XtraUserControl {
      public OLAPDrillDownUserControl() {
            InitializeComponent();
            pivotGridControl.OptionsBehavior.UseAsyncMode = true;
            // ...
            pivotGridControl.CellDoubleClick += async (s, e) => {
                try {
                    pivotGridControl.LoadingPanelVisible = true;
                    PivotDrillDownDataSource ds = await e.CreateDrillDownDataSourceAsync();
                    pivotGridControl.LoadingPanelVisible = false;
                    using(DrillDownForm form = new DrillDownForm(ds))
                        form.ShowDialog();
                } catch(Exception ex) {
                    pivotGridControl.LoadingPanelVisible = false;
                    XtraMessageBox.Show(ex.Message);
                }
            };
        }
    }
}
vb
Imports DevExpress.XtraEditors
Imports DevExpress.XtraPivotGrid
Imports System
Imports System.Windows.Forms

Namespace DxSampleOLAP
    Partial Public Class OLAPDrillDownUserControl
        Inherits XtraUserControl

      Public Sub New()
            InitializeComponent()
            pivotGridControl.OptionsBehavior.UseAsyncMode = True
            ' ...
            AddHandler pivotGridControl.CellDoubleClick, Async Sub(s, e)
                Try
                    pivotGridControl.LoadingPanelVisible = True
                    Dim ds As PivotDrillDownDataSource = Await e.CreateDrillDownDataSourceAsync()
                    pivotGridControl.LoadingPanelVisible = False
                    Using form As New DrillDownForm(ds)
                        form.ShowDialog()
                    End Using
                Catch ex As Exception
                    pivotGridControl.LoadingPanelVisible = False
                    XtraMessageBox.Show(ex.Message)
                End Try
            End Sub
      End Sub
    End Class
End Namespace

See Also

PivotCellEventArgs Class

PivotCellEventArgs Members

DevExpress.XtraPivotGrid Namespace