Page 1 of 2

IWCGJQTimePicker shows 00:00 when field is empty

PostPosted: 09 Oct 2013 09:54
by rhazell43
Hello,

When connected to a DataSource the IWCGJQTimePicker shows 00:00 when field is empty. IWCGJQDatePicker behaves correctly and displays and empty edit... IWCGJQTimePicker should behave the same.

Thanks, Rick.

Re: IWCGJQTimePicker shows 00:00 when field is empty

PostPosted: 09 Oct 2013 19:36
by Jorge Sousa
Hi Rick,

the problem with this is just one:

We consider a null date if its value is 0, which is equivalent to the min date: 12/30/1899

But for times we can't do the same, because 0 is equivalent to 00:00, a valid time.

Do you have any suggestion to overcome this problem?

Best Regards

Re: IWCGJQTimePicker shows 00:00 when field is empty

PostPosted: 09 Oct 2013 20:41
by rhazell43
Can you use the IsNull property of a field? Like:

tblSessionCalc_.FieldByName('SessionDate').IsNull;

Re: IWCGJQTimePicker shows 00:00 when field is empty

PostPosted: 09 Oct 2013 23:44
by Jorge Sousa
Hi Rick

Yes sure, but DataLink is just a 2nd level, we've to establish a value for a null time as well

Regards

Re: IWCGJQTimePicker shows 00:00 when field is empty

PostPosted: 10 Oct 2013 02:31
by rhazell43
how about a blank?

Re: IWCGJQTimePicker shows 00:00 when field is empty

PostPosted: 16 Oct 2013 01:33
by rhazell43
Maybe add an option (that we can set) to imply 00:00 is a null time?

Thanks.

Re: IWCGJQTimePicker shows 00:00 when field is empty

PostPosted: 23 Nov 2016 14:51
by etwoss
Hi

I'm having the same problem.
Not consistent with datetime picker.
I understand the explanation but also see a solution in a IsNull property on the component
if Set to true dont show 00:00

Eric

Re: IWCGJQTimePicker shows 00:00 when field is empty

PostPosted: 28 Nov 2016 11:34
by etwoss
Hi

Sourcecode:

Code: Select all
procedure TIWCGJQCustomTimePicker.DataLinkUpdateControl;
begin
  Time:= TimeOf(DataLink.Field.AsDateTime)
end;


can be replaced with

Code: Select all
procedure TIWCGJQCustomTimePicker.DataLinkUpdateControl;
begin
   if (DataLink.Field.IsNull) then
  begin
     FTimeIsNull := True; // New internal property
  end
  else
  begin
     Time:= TimeOf(DataLink.Field.AsDateTime);
     FTimeIsNull := False;
  end;
 
end;


Based on FTimeIsNull true of false the component shows up empty or filled
Perhaps this is a nice solution for this problem

Eric

Re: IWCGJQTimePicker shows 00:00 when field is empty

PostPosted: 29 Nov 2016 19:20
by Alexander Bulei
Hi,

Added new property NullAsEmpty to DataLink in next beta build.

Best Regards.

Re: IWCGJQTimePicker shows 00:00 when field is empty

PostPosted: 30 Nov 2016 08:05
by etwoss
Hi

Great work!

Eric