cxgrid动态生成footersummary 并获得值

  var f: TcxGridDBTableSummaryItem;


  cx_for_mctv.OptionsView.Footer := true;
  //cxGrid1DBTableView1.OptionsView.Footer := True;
  f := (cx_for_mctv.DataController.Summary.FooterSummaryItems.Add) as TcxGridDBTableSummaryItem;
  f.FieldName := cx_for_mctv.Columns[2].DataBinding.FieldName;
  f.Column := cx_for_mctv.Columns[2];
  f.Kind := skSum;

///////////////////////////////////////////////////////////////////

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

 

 

 

View_Client.DataController.Summary.FooterSummaryValues[0],//得到值
View_Client.DataController.Summary.FooterSummaryTexts //得到显示文字
View_Client.DataController.Summary.FooterSummarys //得到合计对象


你可能感兴趣的:(动态,AS,f)