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.