})(ko, jQuery); |
I'm using observables as providers to the "template" binding like so:
<div data-bind="template:foo"></div>
Then in the viewModel (pseudo-code):
function changeModule() {
foo({
name:"myTemplate",
data: mySubViewModel,
afterRender: mySubViewModel.doTransitionsAndWhatNot
});
}
In 2.0 it's bulletproof but it seems to be flaky in 2.1 where
sometimes the "module" is never swapped out. I haven't seen any errors
in the console, and the fiddle where I tried to reproduce it worked
fine, so it's not clear-cut.
I'll try to get to the root of it and let you know what I find, in the
meantime I figured I would post about it to see if the synopsis rings
any bells with things that may have been changed in 2.1.
Thanks for all the hard work!
Casey
var element = "#dp";
ko.utils.registerEventHandler(element, "change", function () { var observable = valueAccessor(); //jQuery UI DatePicker var value = $.datepicker.formatDate("yy-mm-dd", $(element).datepicker("getDate")) + " 00:00:00"; observable(value); viewModel.SetDate(value); });
// close dropdown on clicking outside of control ko.utils.registerEventHandler($(element), "click", function (event) { var sender = event.srcElement ? event.srcElement : event.target; if( ! $(sender).hasClass("search-query")) eventTarget.fadeOut('fast'); });
function isClickOnCheckableElement(element, eventType) { if ((element.tagName != "INPUT") || !element.type) return false; if (eventType.toLowerCase() != "click") return false; var inputType = element.type.toLowerCase(); return (inputType == "checkbox") || (inputType == "radio"); }
Thanks for the file and willingness to help. I ran it with the debug
file no problems, then switched back to the compressed beta file and
it worked as well. So the problem may have been something else in my
app (I was updating a lot of things yesterday) and all seems to be
working for now.
Regards,
Casey Corcoran