Created
June 9, 2012 17:05
-
-
Save msarchet/2901816 to your computer and use it in GitHub Desktop.
Simple Chosen.js binding handler for knockoutjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//knockout.js can be found at http://www.knockoutjs.com | |
//chosen.js can be found at http://harvesthq.github.com/chosen/ | |
//jquery.js can be found at http://jquery.com | |
//Usage is data-bind="chosen: true" | |
//Want to clean this up to eventually work as | |
//data-bind="chosen: { options: SelectOptions, value: selectValue}" | |
ko.bindingHandlers.chosen = { | |
init: function(element, valueAccessor, allBindingsAccessor, viewModel) { | |
$(element).chosen(); | |
}, | |
update: function(element, valueAccessor, allBindingsAccessor, viewModel) { | |
$(element).trigger("liszt:updated"); | |
} | |
}; |
line 16: should be $(element).trigger("chosen:updated)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this binding is not working for knockout js v3.0