문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top