Knockout.js 两个选择列表共享相同的值绑定,更新缓慢

Knockout.js 两个选择列表共享相同的值绑定,更新缓慢,knockout.js,Knockout.js,我有两个select列表绑定到可观察数组,其中包含对相同数据的不同排序。这两个选择列表值绑定到同一个ObservalArray HTML <select id="countriesAZ" data-bind="value: selectedCountry, options: countriesAZ, optionsText: 'Name', optionsValue: 'Id', optionsCaption: 'Countries a - z'"></select>

我有两个select列表绑定到可观察数组,其中包含对相同数据的不同排序。这两个选择列表值绑定到同一个ObservalArray

HTML

  <select id="countriesAZ" data-bind="value: selectedCountry, options: countriesAZ, optionsText: 'Name', optionsValue: 'Id',  optionsCaption: 'Countries a - z'"></select>

  <select id="countriesByDistance" data-bind="value: selectedCountry, options: countriesDist, optionsText: 'Name', optionsValue: 'Id',  optionsCaption: 'Countries by distance'"></select>
在这一切似乎工作得很好,反应很快,然而,实际阵列有大约1000个项目,并有一个延迟时,改变选择之一


我曾试图限制值绑定,但似乎没有什么不同

在使用
选项
绑定生成的大量选项时,同时使用
绑定,会遇到性能问题。Ryan Niemeyer在中很好地描述了这个问题。他还解释了一些解决这个问题的方法


不过,最简单的修复方法可能是使用my来修复底层的敲除bug。下面是包含Freedom插件的示例:

您确定这里的瓶颈是击倒吗?它很可能只是浏览器呈现的。您是否使用开发人员工具对其进行了分析?就个人而言,从可用性的角度来看,我强烈建议不要使用1000个长下拉菜单。谢谢。我先看了ryans的网站,但没找到。
var myVM = function() {
    var self = this;
    this.countriesAZ = ko.observableArray([{"Id":1,"Name":"Scotland"},{"Id":2,"Name":"England"},{"Id":3,"Name":"Wales"},{"Id":4,"Name":"N. Ireland"}]);
    this.countriesDist = ko.observableArray([{"Id":1,"Name":"Scotland"},{"Id":2,"Name":"England"},{"Id":3,"Name":"Wales"},{"Id":4,"Name":"N. Ireland"}]);
    this.selectedCountry = ko.observableArray();
}

window.viewModel = new myVM();
ko.applyBindings(viewModel);