如何在运行时创建摘要页脚? [英] How can create summary footer on runtime?

查看:99
本文介绍了如何在运行时创建摘要页脚?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用TcxGrid我在执行时创建了字段,因为我有数据透视查询并且列是可变的

I use TcxGrid I have create fields on execution time because I have a pivot query and columns are variable

我像泰斯代码一样填充了网格

I filled my grid like theese codes

grdCevapDBTableView2.BeginUpdate;
grdCevapDBTableView2.ClearItems;
fillGridView(grdCevapDBTableView2,command);
grdCevapDBTableView2.DataController.CreateAllItems;
grdCevapDBTableView2.EndUpdate;

现在,我想从这些列中获取和值。如何在运行时上创建摘要页脚?

Now I want to get sum values from these columns. How can create summary footer on runtime?

推荐答案

例如,假设您有一个名为cost的字段,并且想要对总数进行汇总:

Say for example you had a field called cost and you wanted to summarise the total:

index := grdCevapDBTableView2.GetColumnByFieldName('cost').index;
grdCevapDBTableView2.Columns[index].Summary.Footerkind:=skSum;
grdCevapDBTableView2.Columns[index].Summary.FooterFormat:='£ #.##';

我还将在try..finally块之间粘贴beginupdate和endupdate,即:

I would also stick the beginupdate and endupdate between try..finally block, ie:

grdCevapDBTableView2.BeginUpdate;
try       
  grdCevapDBTableView2.ClearItems;       
  fillGridView(grdCevapDBTableView2,command);       
  grdCevapDBTableView2.DataController.CreateAllItems;       
finally
  grdCevapDBTableView2.EndUpdate;   
end;

这只是确保您的表视图最终将结束更新并重新绘制。

this just ensures that your tableview will eventually end the update and redraw.

这篇关于如何在运行时创建摘要页脚?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆