考慮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");
});
}