I using knockout for mapping JSON obejct to user control, I have a list of single checkboxes, They look like
<input type="checkbox" data-bind="checked: IsEnabled1" />
I Have JsonObject
var viewModel = {
IsEnabled1 :ko.observable(true),
IsEnabled2 :ko.observable(true),
IsEnabled3 :ko.observable(false)
};
...
ko.applyBindings(viewModel);
And I want to add global check box that will be check/uncheck all other, I made this changes on JavaScript side but global check box update UI part but they data from separate check boxes doesn't mapping to JSON object .
Global checkbox
$("#GeneralTable thead tr th:first input:checkbox").click(function () {
var checkedStatus = this.checked;
$("#GeneralTable tbody tr td:first-child input:checkbox").each(function () {
this.checked = checkedStatus;
});
});
after this code my JSON object contain data that not related to UI.
How to update all JSON after change check boxes from JS side ?