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;
  .....
posted @ 2021-05-18 19:45  后凤凰  阅读(241)  评论(0编辑  收藏  举报