这个功能是如何实现的,为什么我用他网站提供的代码取不到数据

dacsd 2008-06-08 07:19:49
这里不会上传图片,我把它放到盒子论坛上了
http://bbs.2ccc.com/topic.asp?topicid=291153
...全文
126 10 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
yudm1976 2009-03-15
  • 打赏
  • 举报
回复
这是Ok的代码,经测试,very good:
在form中添加有关的控件,再使用如下的代码即可。
-----------------
以下是供参考的单元:
uses
... cxCustomData, cxGridTableView, ...

// This form contains the ExpressQuantumGrid with an unbound TableView.

TForm2 = class(TForm)
cxGrid1Level1: TcxGridLevel;
cxGrid1: TcxGrid;
cxGrid1TableView1: TcxGridTableView;
end;

// Creates a drilldown data source for a particular cross cell and displays its data in a form.
procedure cxShowDrillDownDataSource(ACrossCell: TcxPivotGridCrossCell);

// Creates columns in the cxGridTableView for all the pivot grid fields.
procedure CreateColumns(APivotGrid: TcxCustomPivotGrid; AGridView: TcxGridTableView);

var
I: Integer;
AField: TcxPivotGridField;
begin
for I := 0 to APivotGrid.FieldCount - 1 do
begin
AField := APivotGrid.Fields[I];
with AGridView.CreateColumn do
begin
Caption := AField.Caption;
Visible := AField.Visible;
Hidden := AField.Hidden;
end;
end;
end;

var
AForm: TForm2;

ADataSource: TcxCustomDataSource;
begin
AForm := TForm2.Create(nil);
try
CreateColumns(ACrossCell.PivotGrid, AForm.cxGrid1TableView1);
ADataSource := ACrossCell.CreateDrillDownDataSource;
try
// Links a drilldown data source to the grid抯 TableView.
AForm.cxGrid1TableView1.DataController.CustomDataSource := ADataSource;
AForm.ShowModal;
finally
ADataSource.Free;

end;
finally
AForm.Free;
end;
end;

// The pivot grid抯 OnDblClick event handler.
procedure TForm1.cxDBPivotGrid1DblClick(Sender: TObject);
var
ACrossCell: TcxPivotGridCrossCell;
begin
with cxDBPivotGrid1.HitTest do
begin
// Handles double-clicks on data cells
if HitAtDataCell then
begin
// Determines a cross cell which corresponds to the data cell being clicked.

ACrossCell := TcxPivotGridDataCellViewInfo(HitObject).CrossCell;
cxShowDrillDownDataSource(ACrossCell);
end;
end;
end;


dacsd 2008-06-15
  • 打赏
  • 举报
回复
自己解决,谢谢各位参与
dh9450 2008-06-13
  • 打赏
  • 举报
回复
好象你设置了数据源(DataSource)却没设置数据集(DataSet)
dacsd 2008-06-12
  • 打赏
  • 举报
回复
我实现的出现这个问题,在Drill down form中取不到数据,请各位帮忙看看哪里有问题,源码如下:
procedure TForm1.PVGDblClick(Sender: TObject);
var
ACrossCell: TcxPivotGridCrossCell;
AForm: TFrmDrillDown;
ADataSource: TcxCustomDataSource;
begin
with PVG.HitTest do
begin
if HitAtDataCell then
ACrossCell := (HitObject as TcxPivotGridDataCellViewInfo).CrossCell;
end;
AForm := TFrmDrillDown.Create(nil);
try
ADataSource := ACrossCell.CreateDrillDownDataSource;
try
AForm.TableView.DataController.CustomDataSource := ADataSource;
AForm.ShowModal;
finally
ADataSource.Free;
end;
finally
AForm.Free;
end;
end;
----------------------------------------------
dh9450 2008-06-12
  • 打赏
  • 举报
回复
什么代码
dacsd 2008-06-12
  • 打赏
  • 举报
回复
就是利用cxDBPivotGrid做出的交叉表,通过鼠标双击交叉表的数据单元格,获取组成这些数据的详细记录,也就是弹出窗口的GRID,现在的问题是,双击交叉表的数据单元格后,弹出的窗口中的GRID中无数据,代码是官方网站上提供的,不知道为何实现不了。
谢谢关注
dacsd 2008-06-11
  • 打赏
  • 举报
回复
请大家快来看看。
dacsd 2008-06-09
  • 打赏
  • 举报
回复
就是利用cxDBPivotGrid做出的交叉表,通过鼠标双击交叉表的数据单元格,获取组成这些数据的详细记录,也就是弹出窗口的GRID,现在的问题是,双击交叉表的数据单元格后,弹出的窗口中的GRID中无数据,代码是官方网站上提供的,不知道为何实现不了。
谢谢关注
shuihan20e 2008-06-08
  • 打赏
  • 举报
回复
啥意思
大大怪老张 2008-06-08
  • 打赏
  • 举报
回复
没看懂

2,507

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧