更新基因敲除变量值

时间:2017-09-26 21:20:37

标签: javascript knockout.js

我有以下型号

var CountryScopeVM = function (data, root) {
    CountryScopeVM.call(this, data);
    var self = this;
    this.isSelected = ko.observable();
    this.centralImpLowHeadCount = ko.observable();
    this.load(data);   
    }
};
 this.countryScopes = ko.observableList(CountryScopeVM, data.countryScopes, this);

我有以下代码,当选中一个复选框时会调用它。我在这里尝试做的是,当选中main复选框时,countryscope数组中的所有centralImpLowHeadCount都会更新,但它没有更新,我也没有看到UI中的更改。

 selectAllLOWImplementation: function (data, event) {
        var select = $(event.target).is(':checked');
        ko.utils.arrayForEach(model.countryScopes() || [], function (countryScope) {
            countryScope().centralImpLowHeadCount == select;
        });
        return true;
    }

HTML

 <input type="checkbox" data-bind="checked: hasSelectedLOWImplementation, click: selectAllLOWImplementation" />


 <td><input type="checkbox" data-bind="checked: centralImpLowHeadCount, enable: isOn"  /></td>

0 个答案:

没有答案