Grid
//展开分组 
grdVMain.DataController.Groups.FullExpand;

//分组改变时展开分组,FGrouping 为全局变量
procedure TfrmOrderMgr.grdVMainDataControllerGroupingChanged(
  Sender: TObject);
begin
  if FGrouping then Exit;
  if grdVMain.DataController.Groups.GroupingItemCount = 0 then Exit;
  FGrouping := true;
  try
    grdVMain.DataController.Groups.FullExpand;
  finally
    FGrouping := false;
  end;
end;

//给grid上色
//dmMain.cxStyleRecNormal,dmMain.cxStyleRecCompleted为预先创建好的style
//最后将grdVMainFCompleted设为最后一列
procedure TfrmOrderMgr.grdVMainStylesGetContentStyle(
  Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
  AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
var
  AIndex: Integer;
  AVar: Variant;
  ABoolean: Boolean;
begin
  if grdVMainFCompleted.GroupIndex <> -1 then Exit; //分组时不分颜色
  AIndex := grdVMainFCompleted.Index;
 // AIndex := AIndex - grdVMain.DataController.Groups.GroupingItemCount;
  AVar := ARecord.Values[AIndex];
  if VarIsOrdinal(AVar) then ABoolean := AVar else ABoolean := false; //是否为bool值
  if ABoolean then
    AStyle := dmMain.cxStyleRecCompleted else AStyle := dmMain.cxStyleRecNormal;
end;

相关文章:

  • 2022-12-23
  • 2022-03-08
  • 2021-04-24
  • 2022-12-23
  • 2021-10-05
猜你喜欢
  • 2022-12-23
  • 2021-11-19
  • 2021-06-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-18
相关资源
相似解决方案