考虑this jsfiddle。ObservableArray子可观察变化监测
我想不出如何确保如果在下拉列表中选择了第一行,下一行将被阻止选择相同的值。
我认为我的问题在于,当下拉单击事件触发时,用户不会在孩子值发生变化时监视此更改。任何人都可以协助?
viewModel.actualMetrics.subscribe(function(newValue) {
if (newValue) {
$.each(viewModel.actualMetrics(), function(n, item) {
if (item.MetricTypeId() == newValue.MetricTypeId)
alert("already selected this Metric");
});
}