Open Kamilius opened 10 years ago
Haven't played with it yet, but here's my initial guess:
knockout only updates the observable when you type in the input field. If the value of the input field is changed via a script, then I'm not sure that the change event will be fired for the field.
What you need to do, is listen to some event that indicates a change to the value via this widget, then manually trigger the 'change' event on the input field.
If you set valueUpdate: 'input', then you should trigger the 'input' event on the element instead of the change event.
$(element).trigger('input'); // or 'change'
Since I haven't played with this widget yet, I don't know what sort of event you might listen to. If there's no standard event, perhaps you can hack it by looking for the appended widget (using the .find( .. query ..)
method) and listen to click events inside it?
Hi. I can't get this plugin working with KnockoutJS. Each time i'm showing an input, it's using knockout bindinghandler to initialize a datetimepicker:
HTML: input data-bind="dateTimePicker: true, value: eventBeginningDate" id="EventStartDate" name="EventStartDate" type="text" value
JS: ko.bindingHandlers.dateTimePicker = { init: function (element, valueAccessor) { $(element).appendDtpicker({ 'locale': 'ru' }); } }
datepicker gets initialized successfuly, changing value of input. But change of input value doesn't trigger ko.observable(eventBeginningDate) value change for some reason. Could you, please, try to help me with this issue? Thanks in advance