Created
June 28, 2015 22:44
-
-
Save jgautsch/fec43230c1a1f8aca497 to your computer and use it in GitHub Desktop.
jquery.uniform.js checkbox knockout binding handler
This file contains hidden or 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
ko.bindingHandlers.checkedUniform = { | |
init: function(element, valueAccessor) { | |
ko.bindingHandlers.checked.init(element, valueAccessor); | |
$(element).uniform(); | |
}, | |
update: function(element, valueAccessor) { | |
var value = ko.utils.unwrapObservable(valueAccessor()); | |
if (value === null) { | |
element.indeterminate = true; | |
} | |
else { | |
element.indeterminate = false; | |
} | |
$.uniform.update($(element)); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment