Skip to content

Commit

Permalink
Fixed changing of selected checkbox, when it is disabled
Browse files Browse the repository at this point in the history
faulknercs committed Feb 19, 2016
1 parent 7a6f08e commit cc768f1
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/bindings/checkboxBinding.js
Original file line number Diff line number Diff line change
@@ -10,17 +10,19 @@ ko.bindingHandlers.checkbox = {
value = valueAccessor(),
data = $checkbox.val(),
isChecked = $checkbox.parent().hasClass('active');

if(!$checkbox.prop('disbled')) {
if (ko.unwrap(value) instanceof Array) {
var index = ko.utils.arrayIndexOf(ko.unwrap(value), (data));

if (ko.unwrap(value) instanceof Array) {
var index = ko.utils.arrayIndexOf(ko.unwrap(value), (data));

if (isChecked && (index === -1)) {
value.push(data);
} else if (!isChecked && (index !== -1)) {
value.splice(index, 1);
if (isChecked && (index === -1)) {
value.push(data);
} else if (!isChecked && (index !== -1)) {
value.splice(index, 1);
}
} else {
value(isChecked);
}
} else {
value(isChecked);
}
}, 0);
};

0 comments on commit cc768f1

Please sign in to comment.