In cxgrid,I am summing time in a footer (the field in question is a Time field). I have changed its property to TimeEdit and changed its time display format to 'tfHourMin'. However I can not do that to the underlying footer. It keeps displaying hh:mm:ss. Is there a way to have the footer display also 'tfHourMin' format ???
edit : If I do this I get "Could not convert variant of type (Null) into type (Double" error
procedure TForm1.cxGrid1DBTableView1TcxGridDBDataControllerTcxDataSummaryFooterSummaryItems1GetText(
Sender: TcxDataSummaryItem; const AValue: Variant; AIsFooter: Boolean;
var AText: string);
begin
AText := FormatDateTime('hh:mm', AValue);
end;
You could use the summary item's OnGetText
event to provide your own text to display, something like
procedure TForm1.H_FormatSummaryItem(Sender: TcxDataSummaryItem; const AValue: Variant; AIsFooter: Boolean; var AText: string);
begin
if(TVarData(AValue).VType in [varNull, varEmpty])then AText := ''
else begin
if((Sender as TcxGridTableSummaryItem).Kind = skSum)then begin
AText := FormatDateTime('hh:nn', AValue);
end;
end;
end;