jquery - Using custom knockoutjs select binding with standard select bindings as well -
i trying combine custom knockoutjs binding standard binding. although have been able find related solution
ko.bindinghandlers.parentareacombobox = { initialised: false, init: function (element, valueaccessor, allbindingsaccessor, viewmodel, context) { viewmodel.parentareas.subscribe(function (newparentareas) { if (newparentareas && newparentareas.length > 0) { if (ko.bindinghandlers.parentareacombobox.initialised) { return; } ko.applybindingstonode(element, { options: viewmodel.parentareas, optionscaption: 'choose...', optionstext: 'label', value: viewmodel.selectedparentarea }); $(element).chosen({}); ko.bindinghandlers.parentareacombobox.initialised = true; } }); } };
but not able make work on mine. doing wrong here?
use debugging console in browser (press f12) , jshint button in jsfiddle. vm constructor function invalid. once fix that, you'll notice you're trying use subscribe
on not observable.
Comments
Post a Comment