jQWidgets Forums
jQuery UI Widgets › Forums › Editors › DateTimeInput › The formatString property cannot be used in the Knockout Integration
This topic contains 4 replies, has 3 voices, and was last updated by Peter Stoev 10 years, 10 months ago.
-
Author
-
August 30, 2014 at 2:07 pm The formatString property cannot be used in the Knockout Integration #58971
Hi;
We use Jqxwidget with Knockout together. but the formatString property cannot work. We cannot use this property.August 30, 2014 at 6:03 pm The formatString property cannot be used in the Knockout Integration #58975Hi ziyahan,
We cannot find anything wrong with that property and how it works with KO. Please, find below a working sample:
<!DOCTYPE html> <html lang="en"> <head> <title id="Description">Integration of jqxDateTimeInput with Knockout</title> <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" /> <script type="text/javascript" src="../../scripts/jquery-1.10.2.min.js"></script> <script type="text/javascript" src="../../scripts/json2.js"></script> <script type="text/javascript" src="../../scripts/knockout-3.0.0.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script> <script type="text/javascript" src="../../scripts/demos.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/globalization/globalize.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxknockout.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcheckbox.js"></script> <script type="text/javascript"> $(document).ready(function () { var viewModel = function (date) { this.date = ko.observable(date); this.disabled = ko.observable(false); this.displayDate = function () { alert("Date: " + this.date()); } this.setDate = function () { var date = new Date(); date.setFullYear(2012, 11, 11); this.date(date); } }; var date = new Date(); date.setFullYear(2012, 10, 10); ko.applyBindings(new viewModel(date)); }); </script> </head> <body class='default'> <div id="input" data-bind="jqxDateTimeInput: {value: date, formatString: 'dddd MMM', disabled: disabled, width: '250px', height: '25'}"> </div> <div style="margin-top: 5px; clear: both;"> <input id="getButton" data-bind="click: displayDate, jqxButton: {}" type="button" value="Get Value" /> <input id="setButton" data-bind="click: setDate, jqxButton: {}" type="button" value="Set Value" /> <div data-bind="jqxCheckBox: {checked: disabled, width: '100px'}" style='margin-top: 5px;' id="checkBox">Disabled</div> </div> </body> </html>
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/September 1, 2014 at 6:37 am The formatString property cannot be used in the Knockout Integration #58984Peter;
Thanks for your reply. It has been done. It did not work because of that I wrote formatString wrongly like “DD-MM-YYYY”. Sorry.
Thanks again.September 11, 2014 at 1:19 pm The formatString property cannot be used in the Knockout Integration #59435I’m using the version 3.0.4 and I have a problem setting a different ‘formatString’ parameter (MM/dd/yyyy).
When I initialize the component with the value null – ko.observable(null) – and after I set some date, the component shows the date with the default format (formatString dd/MM/yyyy).
When I initialize with use some value (new Date(), by example) the component works as expected!Thank you for some help.
PRicardo
September 11, 2014 at 4:18 pm The formatString property cannot be used in the Knockout Integration #59439Hi PRicardo,
You can try the same with jQWidgets 3.4. In the version which you use “null” is invalid value for the DateTimeInput.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.