So I've been using a custom binding for the Date Picker, no problem. In switching to the inline version, however, things aren't working as smoothly. My input was already contained within a DIV, so I just adjusted decided to target the element's parent. The new custom binding as follows:
ko.bindingHandlers.datepicker = {
init: function(element, valueAccessor, allBindingsAccessor) {
var options = { dateFormat: 'mm/dd/yy', showButtonPanel: true, changeMonth: true, changeYear: true, showOtherMonths: true, selectOtherMonths: true };
$(element).parent().datepicker(options);
ko.utils.registerEventHandler($(element).parent(), "change", function() {
var observable = valueAccessor();
observable($(element).parent().datepicker("getDate"));
});
ko.utils.domNodeDisposal.addDisposeCallback(element, function() {
$(element).parent().datepicker("destroy");
});
},
update: function(element, valueAccessor) {
var value = ko.utils.unwrapObservable(valueAccessor());
$(element).parent().datepicker("setDate", value);
}
};
Now, this mostly works. What is no longer working are my month and year selection drop-downs. For some reason, they're totally borked. Everything else though works as expected.