cxGrid Group当中的列GetDisplayText从Arecord读取数据

Posted 后凤凰

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了cxGrid Group当中的列GetDisplayText从Arecord读取数据相关的知识,希望对你有一定的参考价值。

情况说明

col_Index是cxGirdDBView中的列,被添加到Group当中
GetDisplayText时需要读取数据记录,测试时发现其从Arecord读取中读取的的数据不对

看源码是在group当中导致
使用下面方法处理,找到其下一条Record从中读取
procedure TfrmHOEditRecipe.col_IndexGetDisplayText(Sender:
    TcxCustomGridTableItem; ARecord: TcxCustomGridRecord; var AText: string);
var
  AID, BID: Integer;
  sID: string;
  sType: string;
  lRecord:TcxCustomGridRecord;
begin
  inherited;
  lRecord:=ARecord.ViewData.GetRecordByIndex(ARecord.index+1);
  if lRecord=nil then
    Exit;
  if VarIsNull(lRecord.Values[col_Type.Index]) then
  begin
    lRecord.Values[col_Type.Index] := 0;
    sID := IntToStr(0);
    AID := 0;
    BID := 1;
  end
  else
  begin
    sID := lRecord.Values[col_ID.Index];
    sType:=  lRecord.Values[col_Type.Index];
    AID:=StrToIntDef(sType, 1);
    BID:=StrToIntDef(Copy(sID, Length(sType)+1, Length(sID)), 1);
  end;
  .....

以上是关于cxGrid Group当中的列GetDisplayText从Arecord读取数据的主要内容,如果未能解决你的问题,请参考以下文章

cxGrid使用汇总

Delphi CxGrid 汇总

Delphi cxGrid使用汇总

CxGrid用法汇总

delphi10 cxgrid控件怎么啦出来

如何在delphi里cxgrid单击某一个单元格弹出树形结构