首页 > 其他 > 详细

控制cxGrid 主从表的明细只展开一个

时间:2014-11-14 14:09:28      阅读:641      评论:0      收藏:0      [点我收藏+]
procedure TForm.ADetailDataControllerCollapsing(
  ADataController: TcxCustomDataController; ARecordIndex: Integer;
  var AAllow: Boolean);
var
  I: Integer;
  C: Integer;
begin
  AAllow := False;
  C := 0;
  for I := 0 to ADataController.RecordCount - 1 do
  begin
    if ADataController.GetDetailExpanding(I) then
      Inc(C);
    if C > 1 then
      AAllow := True;
  end;
end;


procedure TForm.ADetailDataControllerExpanding(
  ADataController: TcxCustomDataController; ARecordIndex: Integer;
  var AAllow: Boolean);
begin
  ADataController.CollapseDetails;
end;

procedure TForm.FormCreate(Sender: TObject);
begin
  inherited;
  //控制只展开一个明细
  cxGridVMain.DataController.OnDetailExpanding := ADetailDataControllerExpanding;
  cxGridVMain.DataController.OnDetailCollapsing := ADetailDataControllerCollapsing;

end;

 


控制cxGrid 主从表的明细只展开一个

原文:http://www.cnblogs.com/yooplmqj/p/4097046.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!