#1 2016-04-20 13:56:22

igors233
Member
Registered: 2012-09-10
Posts: 233

Display field names and TRecordEditForm handling date only field

What is a proper way to change display name for a field in TSQLTableToGrid column, example:

TSQLMyRec = class(TSQLRecord)
private
  FDateField: TDateTime;
  FFieldName: RawUTF8;
published
  property DateField: TDateTime read FDateField write FDateField;
  property FieldName: RawUTF8 read FFieldName write FFieldName;
end;

When displaying in grid I would like to be called CustomFieldName instead of FieldName;


Second question is related to, TRecordEditForm, it will create two datetimepicker controls for DateField, first for date part and second for timepart.
I do not need time part since this is a date only field, so is there a way to instruct it not to create timepart control somehow?
OnComponentCreated will be invoked only for first (date) control.

To me, a cleanest solution would be to allow declaring fields with TDate type, they would be stored in DB internally as INTEGER (or text as is TDateTime), but for displaying/editing purposes they would be treated as true date only fields.

Offline

#2 2016-04-20 14:32:58

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,183
Website

Re: Display field names and TRecordEditForm handling date only field

With external DB, the date/time column uses the native date/time type of the DB.
Only under SQLite3 it is stored as iso-8601 text.
We define only a date/time type, since our goal was to reduce the number of types in SynDB.

Then you could customize the displayed value at client code level.
And you better should, since date/time should be stored as UTC in the ORM/DB, and displayed with local zone.

AFAIK you can customize the TSQLTableToGrid returned values, even for field names.
Search for the appropriate event handler.

About TRecordEditForm, try to modify it, and submit your patch.

Offline

Board footer

Powered by FluxBB