开发者

How can create summary footer on runtime?

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.ClearI开发者_运维问答tems;
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?


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:='£ #.##';

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜