cxgrid动态创建footer

procedure CreateSumFooter(cxTableView: TcxGridDBTableView;
  const fieldList: string);
var
  i: Integer;
  f: TcxGridDBTableSummaryItem;
  l: TStringList;
begin
  l := TStringList.Create;
  l.DelimitedText := fieldList;
  l.Delimiter := ',';
  cxGrid1DBTableView1.OptionsView.Footer := True;
  for i := 0 to cxGrid1DBTableView1.ColumnCount - 1 do
  begin
    if l.IndexOf(cxGrid1DBTableView1.Columns[i].DataBinding.FieldName) <> -1 then
    begin
      f := (cxGrid1DBTableView1.DataController.Summary.FooterSummaryItems.Add) as TcxGridDBTableSummaryItem;
      f.FieldName := cxGrid1DBTableView1.Columns[i].DataBinding.FieldName;
      f.Column := cxGrid1DBTableView1.Columns[i];
      f.Kind := skSum;
    end; 
  end;
  l.Free;
end;

 

你可能感兴趣的:(grid)