111
This commit is contained in:
parent
3a9f2c980f
commit
1e867f1d48
46
public10/design/cxPivotDrillDownFormUnit.dfm
Normal file
46
public10/design/cxPivotDrillDownFormUnit.dfm
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
object frmDrillDown: TfrmDrillDown
|
||||||
|
Left = 278
|
||||||
|
Top = 278
|
||||||
|
ActiveControl = cxGrid1
|
||||||
|
Caption = 'Drill Down Form'
|
||||||
|
ClientHeight = 495
|
||||||
|
ClientWidth = 754
|
||||||
|
Color = clBtnFace
|
||||||
|
Font.Charset = DEFAULT_CHARSET
|
||||||
|
Font.Color = clWindowText
|
||||||
|
Font.Height = -11
|
||||||
|
Font.Name = 'Tahoma'
|
||||||
|
Font.Style = []
|
||||||
|
OldCreateOrder = False
|
||||||
|
Position = poMainFormCenter
|
||||||
|
PixelsPerInch = 96
|
||||||
|
TextHeight = 13
|
||||||
|
object cxGrid1: TcxGrid
|
||||||
|
Left = 0
|
||||||
|
Top = 0
|
||||||
|
Width = 754
|
||||||
|
Height = 495
|
||||||
|
Align = alClient
|
||||||
|
TabOrder = 0
|
||||||
|
ExplicitWidth = 644
|
||||||
|
ExplicitHeight = 349
|
||||||
|
object TableView: TcxGridTableView
|
||||||
|
Navigator.Buttons.CustomButtons = <>
|
||||||
|
ScrollbarAnnotations.CustomAnnotations = <>
|
||||||
|
DataController.Summary.DefaultGroupSummaryItems = <>
|
||||||
|
DataController.Summary.FooterSummaryItems = <>
|
||||||
|
DataController.Summary.SummaryGroups = <>
|
||||||
|
OptionsView.Footer = True
|
||||||
|
OptionsView.FooterAutoHeight = True
|
||||||
|
end
|
||||||
|
object cxGrid1Level1: TcxGridLevel
|
||||||
|
GridView = TableView
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object cxGridPopupMenu1: TcxGridPopupMenu
|
||||||
|
Grid = cxGrid1
|
||||||
|
PopupMenus = <>
|
||||||
|
Left = 208
|
||||||
|
Top = 287
|
||||||
|
end
|
||||||
|
end
|
77
public10/design/cxPivotDrillDownFormUnit.pas
Normal file
77
public10/design/cxPivotDrillDownFormUnit.pas
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
unit cxPivotDrillDownFormUnit;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||||
|
Dialogs, StdCtrls, ExtCtrls, cxCustomPivotGrid, cxStyles, cxCustomData,
|
||||||
|
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData,
|
||||||
|
cxGridLevel, cxClasses, cxControls, cxGridCustomView,
|
||||||
|
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGrid,
|
||||||
|
cxContainer, cxTextEdit, cxMemo, cxRichEdit, RichEdit, cxHyperLinkEdit,
|
||||||
|
cxLabel, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxDateRanges, dxScrollbarAnnotations,
|
||||||
|
dxSkinsCore, dxSkinsDefaultPainters, dxSkinWXI, dxBarBuiltInMenu,
|
||||||
|
cxGridCustomPopupMenu, cxGridPopupMenu;
|
||||||
|
|
||||||
|
type
|
||||||
|
TfrmDrillDown = class(TForm)
|
||||||
|
cxGrid1Level1: TcxGridLevel;
|
||||||
|
cxGrid1: TcxGrid;
|
||||||
|
TableView: TcxGridTableView;
|
||||||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure cxShowDrillDownDataSource(ACrossCell: TcxPivotGridCrossCell);
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
cxSpinEdit, ShellAPI;
|
||||||
|
|
||||||
|
{$R *.dfm}
|
||||||
|
|
||||||
|
procedure cxShowDrillDownDataSource(ACrossCell: TcxPivotGridCrossCell);
|
||||||
|
var
|
||||||
|
AForm: TfrmDrillDown;
|
||||||
|
ADataSource: TcxCustomDataSource;
|
||||||
|
|
||||||
|
procedure CreateColumns(APivotGrid: TcxCustomPivotGrid; AGrid: TcxGridTableView);
|
||||||
|
var
|
||||||
|
I: Integer;
|
||||||
|
AColumn: TcxGridColumn;
|
||||||
|
AField: TcxPivotGridField;
|
||||||
|
begin
|
||||||
|
for I := 0 to TcxPivotGridCrossCellDataSource(ADataSource).FieldCount - 1 do
|
||||||
|
begin
|
||||||
|
AField := TcxPivotGridCrossCellDataSource(ADataSource).PivotGridFields[I];
|
||||||
|
AColumn := AGrid.CreateColumn;
|
||||||
|
AColumn.Caption := AField.Caption;
|
||||||
|
AColumn.Hidden := AField.Hidden;
|
||||||
|
AColumn.Visible := AField.Visible;
|
||||||
|
if (AField.UniqueName = '[Measures].[Discount]') or (AField.UniqueName = 'Discount') then
|
||||||
|
begin
|
||||||
|
AColumn.PropertiesClass := TcxSpinEditProperties;
|
||||||
|
TcxSpinEditProperties(AColumn.Properties).ValueType := vtFloat;
|
||||||
|
TcxSpinEditProperties(AColumn.Properties).DisplayFormat := '0.00';
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
AForm := TfrmDrillDown.Create(nil);
|
||||||
|
try
|
||||||
|
ADataSource := ACrossCell.CreateDrillDownDataSource;
|
||||||
|
CreateColumns(ACrossCell.PivotGrid, AForm.TableView);
|
||||||
|
try
|
||||||
|
AForm.TableView.DataController.CustomDataSource := ADataSource;
|
||||||
|
AForm.TableView.ApplyBestFit();
|
||||||
|
AForm.ShowModal;
|
||||||
|
finally
|
||||||
|
ADataSource.Free;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
AForm.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user