Skip to main content
All docs
V24.2

PivotGridControl.CreateDrillDownDataSourceAsync(Int32, Int32, List<String>) Method

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

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.XtraPivotGrid.v24.2.dll

Declaration

public Task<PivotDrillDownDataSource> CreateDrillDownDataSourceAsync(
    int columnIndex,
    int rowIndex,
    List<string> customColumns
)

Parameters

Name Type Description
columnIndex Int32

A zero-based integer that identifies the visible index of the column. Pass -1 as a column index to obtain the column’s Grand Total.

rowIndex Int32

A zero-based integer that identifies the visible index of the row. Pass -1 as a row index to obtain the row’s Grand Total.

customColumns List<String>

A list of columns to be returned.

Returns

Type Description
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

This example executes an asynchronous operation that creates a drill-down data source for the selected Pivot Grid cell and gets the operation result - the underlying data source.

In this example, the Pivot Grid control is bound to the LinqServerModeSource data source and operates in server mode.

The PivotGridControl.CellClick event handler calls the PivotGridControl.CreateDrillDownDataSourceAsync method to generate a drill-down data source for the selected cell. The method parameter specifies the number of records to return. The method also specifies the columns to add to the data set.

The GridControl displays the underlying records (the created PivotDrillDownDataSource) in the auxiliary DrillDownForm.

View Example

using DevExpress.XtraPivotGrid;
using System;
using System.Collections.Generic;

namespace XtraPivotGrid_CreateDrillDownDataSourceAsync {
    public partial class Form1 : DevExpress.XtraEditors.XtraForm {
        DrillDownForm dForm;
        public Form1() {
            InitializeComponent();
            this.Load += Form1_Load;
            pivotGridControl1.CellClick += pivotGridControl1_CellClick;
            // This line of code is generated by Data Source Configuration Wizard
            linqServerModeSource1.QueryableSource = 
            new XtraPivotGrid_CreateDrillDownDataSourceAsync.DataClasses1DataContext().Invoices;
        }

        async void pivotGridControl1_CellClick(object sender, PivotCellEventArgs e) {
            PivotGridControl pivot = sender as PivotGridControl;
            if (dForm.IsDisposed) LoadDrillDownForm();

            //Check whether an asynchronous operation is in progress.
            if (!pivot.IsAsyncInProgress) 

            // Get the record set associated with the clicked cell.
            dForm.DataSource =  await pivot.CreateDrillDownDataSourceAsync(e.ColumnIndex, 
            e.RowIndex, 25, new List<string> { "ProductName","Quantity" });            
        }

        void Form1_Load(object sender, EventArgs e) {
            LoadDrillDownForm();
        }

        void LoadDrillDownForm() {
            dForm = new DrillDownForm();
            dForm.Show();
        }
    }
}
See Also