jQWidgets Forums
jQuery UI Widgets › Forums › Editors › DateTimeInput › Is it possible for it to be null?
Tagged: calendar, date picker, datetimeinput, javascript datepicker, jquery date input, jqxdatetimeinput, null values
This topic contains 14 replies, has 5 voices, and was last updated by jqWizard 12 years, 11 months ago.
-
Author
-
I have it bound to a model field and it’s null. I’d like to show blank on the screen. Is it possible?
Hi martyphee,
Null values are currently not supported. We will implement this feature for the next release.
If you want to show the DateTimeInput blank, you can use this code:
$("#jqxWidget").jqxDateTimeInput('dateTimeInput').val('');
Best Regards,
Peter Stoevhttp://www.jqwidgets.com
jQWidgets TeamHi martyphee,
In jQWidgets 1.7, we implemented the Null Values support in the jqxDateTimeInput widget. In order to set the value to null, you can use the code below:
$("#jqxWidget").jqxDateTimeInput('setDate', null);
Best Regards,
Peter Stoevhttp://www.jqwidgets.com
jQWidgets TeamHi, I still got the same problem on version 2.0. I cannot call ‘setDate’ and set the value to ‘null’
Hi ajesicus,
You should set the date to null, not ‘null’.
i.e
$("#jqxWidget").jqxDateTimeInput('setDate', null);
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comyeah, that’s is what i did and what an error say is ‘C is null’ in jqxdatetimeinput.js
I am unable to reproduce it.
This is my test code and it works as expected:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head> <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" /> <script type="text/javascript" src="../../scripts/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="../../scripts/gettheme.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxdatetimeinput.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcalendar.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxtooltip.js"></script> <script type="text/javascript" src="../../jqwidgets/globalization/jquery.global.js"></script></head><body> <div id='content'> <script type="text/javascript"> $(document).ready(function () { var theme = getTheme(); // Create a jqxDateTimeInput $("#jqxWidget").jqxDateTimeInput({ width: '250px', height: '25px', theme: theme }); $("#jqxWidget").jqxDateTimeInput('setDate', null); }); </script> <div id='jqxWidget'> </div> </div></body></html>
Could you post here a sample code which reproduces this issue?
Looking forward to your reply.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comOk, i’ve tried with the plain text html as you did, It’s work fine. But when i put this html template into my javascript, it’s error. This may be my code issue.
i’ll try to figure it out.
Thank you. Your JQx save my time. ;=)
When I delete (using key backspace or del) value in jqxDateTimeInput widget it resets to min value. Is it possible to delete so the widget has no value(null or ”)?
It is not possible to set null value or “” with keyboard combination.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comAny estimates when will it be possible?
Hi,
Why I set null value to jqxDateTimeInput widget with setDate method, and after that it return current date when I use getDate method?Hi thinhvu,
It is more correctly the returned value to be null. Thank you about that. There’s an ‘if’ statement inside the ‘getDate’ method which checks whether the value is undefined and returns new Date if it is. We’ll consider changing this behavior in the future updates.
Best Wishes,
Peter StoevjQWidgets Team
http://www.jqwidgets.comRegarding the question when it will be possible to set Null date with keyboard combination:
This functionality will be implemented in the upcoming build of jQWidgets. Users will be able to set null Date by pressing ctrl+del, ctrl+backspace keyboard combinations. Pressing only Del or Backspace will result in the same behavior as now – reset the edited date part to its minimum value.
Best Wishes,
Peter StoevjQWidgets Team
http://www.jqwidgets.comI would recommend the opposite approach. Using ctrl+del and ctrl+backspace keyboard combinations to reset the edited date part to its minimum value and using keys del and backspace to set null Date. I think most users would expect such behaviour.
-
AuthorPosts
You must be logged in to reply to this topic.