jquery ui - using JQueryUI DateTimePicker with Knockout -


in continuation of knockout js bind datetimepicker gives exception able use datetimepicker knockout unable use time picker option of same tool code have tried embedded following jsfiddle throwing error

<code> http://jsfiddle.net/saqibshakil/scdet/ </code> 

check console after edit

looks calling getdate on timepicker not return actual date.

it appears can call using datetimepicker successfully. so, binding like:

ko.bindinghandlers.timepicker = {     init: function (element, valueaccessor, allbindingsaccessor) {         //initialize timepicker optional options         var options = allbindingsaccessor().timepickeroptions || {};         $(element).timepicker(options);          //handle field changing         ko.utils.registereventhandler(element, "change", function () {             var observable = valueaccessor();             observable($(element).datetimepicker("getdate"));         });          //handle disposal (if ko removes template binding)         ko.utils.domnodedisposal.adddisposecallback(element, function () {             $(element).timepicker("destroy");         });      },     //update control when view model changes     update: function (element, valueaccessor) {          var value = ko.utils.unwrapobservable(valueaccessor()),             current = $(element).datetimepicker("getdate");          if (value - current !== 0) {             $(element).datetimepicker("setdate", value);         }     } }; 

updated sample: http://jsfiddle.net/rniemeyer/l3bnw/


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -