PivotGridCustomSummaryEventArgsBase<T>.CreateDrillDownDataSource() Method
Returns data records associated with the current cell.
Namespace: DevExpress.XtraPivotGrid.Data
Assembly: DevExpress.PivotGrid.v24.1.Core.dll
NuGet Packages: DevExpress.PivotGrid.Core, DevExpress.Win.Navigation
Declaration
Returns
Type | Description |
---|---|
PivotDrillDownDataSource | A PivotDrillDownDataSource object that contains the records associated with the current cell. |
Remarks
The CreateDrillDownDataSource method retrieves data source records used to calculate current cell values.
The Pivot Grid control cells display summary and total summary values. Column and row headers display values used as criteria applied to the underlying data source to obtain a set of data records for summary calculation.
Consider the Pivot Grid control in the following image.
The value in the top-leftmost cell ($1,422.00) is calculated using the ‘Product Sales’ field for a set of records that satisfy the following criteria:
- the ‘Category Name’ field has the value ‘Beverages’
- the ‘Product Name’ field has the value ‘Chai’
- the ‘Shipped Year’ field has the value 2014
The value at the intersection of the first column and third row ($4,154.96) is calculated for the records that satisfy the following criteria:
- the ‘Category Name’ field has the value ‘Beverages’
- the ‘Shipped Year’ field has the value 2014
Example
The following example shows how to display the records from the control’s underlying data source which correspond to a particular cell. A new form that displays these records is opened when a particular cell in the PivotGrid control is double-clicked.
In the example the PivotGridControl.CellDoubleClick event is handled. The PivotCellEventArgsBase<TField, TData, TCustomTotal>.CreateDrillDownDataSource method is called to obtain the list of records associated with the clicked cell.
The following image shows a sample PivotGrid control which is bound to the Invoices table in the nwind.mdb database:
Clicking the third cell in the 1994 column will invoke the following form:
It lists all the orders made in 1994 by Belgian customers.
using DevExpress.XtraPivotGrid;
private void pivotGridControl1_CellDoubleClick(object sender, PivotCellEventArgs e) {
// Create a new form.
Form form = new Form();
form.Text = "Records";
// Place a DataGrid control on the form.
DataGrid grid = new DataGrid();
grid.Parent = form;
grid.Dock = DockStyle.Fill;
// Get the recrd set associated with the current cell and bind it to the grid.
grid.DataSource = e.CreateDrillDownDataSource();
form.Bounds = new Rectangle(100, 100, 500, 400);
// Display the form.
form.ShowDialog();
form.Dispose();
}